In this section, you will create an Amazon EC2 instance with NICE DCV, then access it.
The following steps use a CloudFormation template to create an instance profile, allowing the EC2 instance to access the NICE DCV licensing buckets:
curl https://www.hpcworkshops.com/scripts/dcv_license.zip -o dcv_license.zip
unzip dcv_license.zip
cd dcv_license
bash cfn_dcv_role.sh
cd ..
While waiting for the instance profile to be created, you can review the content in cfn_dcv_role.sh and cfn_dcv_policy.yaml to understand what the the behavior of the CloudFormation template. As described in Licensing the NICE DCV Server, the EC2 instance running the NICE DCV server must be able to reach the Amazon S3 endpoint and has permission to access the required S3 objects for NICE DCV licensing. The above-mentioned steps creates an instance profile (DCVInstanceProfile-DCVBucketsInstanceProfile-xxxxxxxx
), with the following access policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::dcv-license.<region>/*"
}
]
}
aws cloudformation describe-stacks --stack-name DCVInstanceProfile --output text --query 'Stacks[0].Outputs[?OutputKey == `InstanceProfileARN`].OutputValue'
Add Storage: Choose Next: Add Storage and leave the Storage section with default settings.
Add Tags: Choose Next: Add Tags. Here you will tag your EC2 instance. Click on Add Tag, in the Key enter Name and in the Value enter [Your Instance Name]. This name is shown on EC2 Dashboard. Now, choose Next: Configure Security Group.
Choose Review and Launch. Ignore any warning messages.
On the review page, choose Launch, then select the lab-your-key SSH key-pair you created earlier. Click on Launch Instances
Your instance is getting launched. Go to EC2 Dashboard and click on Instances to check status
Next, we will connect to the instance.