How to configure DNS in AWS Route 53 for a NICE DCV Server

In this guide we explain the steps to assign a DNS entry in the AWS Route 53 DNS service to an IP address of a DCV server. This e.g. offers readable server names for DCV users or allows us to configure certificates for web-browser based access to NICE DCV servers.

After you have created the hosted zone for your domain in Route 53 (https://console.aws.amazon.com/route53/home) :

You can find the “Hosted Zone ID” in the Hosted Zone overview to the right:

Either you have a predefined hostname or you want to create one on the fly like in this example:

string=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo ''`
fulldnsname="server-$string.YOUR-DOMAIN.com"

which gives e.g. a hostname like this:

server-cBVxetWN9efHW.YOUR-DOMAIN.com

Now we want to assign the DNS name in Route 53 to the IP address of the DCV server. For this we create the following JSON-file:

pubip="IP_ADDRESS_OF_DCV_SERVER"
cat >> r53.$$.json <<EOF
{
            "Comment": "CREATE a DNS record for the DCV Server",
            "Changes": [{
            "Action": "CREATE",
                        "ResourceRecordSet": {
                                    "Name": "$fulldnsname",
                                    "Type": "A",
                                    "TTL": 300,
                                 "ResourceRecords": [{ "Value": "$pubip"}]
}}]
}
EOF

Which we apply with the following aws-cli command (please replace YOUR_ZONE_ID with your Route 53 Zone ID):

aws route53 change-resource-record-sets --hosted-zone-id YOUR_ZONE_ID --change-batch file://r53.$$.json
rm r53.$$.json

If you like you can store the returned string from the aws-cli route 53 command into a variable and do some additional checking on the return value.

The new DNS entry should be immediately visible in your AWS Route 53 console and after a few seconds to around a minute also in your DNS client – which you could check e.g. with the command

dig server-cBVxetWN9efHW.YOUR-DOMAIN.com

If you have any questions or comments let us know at our contact page.