DNS ICON

Creating custom DNS entries for servers within AWS VPC’s

At work we’re in the process of moving our clinical servers into Amazon’s Web Services. These clinical application servers need access to HSCN. The Health and Social Care Network (HSCN) provides a reliable, efficient and flexible way for healthcare organisations to access and exchange electronic information.

HSCN provides its own private DNS servers and our application servers need to resolve NHS domain names from these DNS servers. When the application servers are booted up they configure and auto generate the /etc/resolv.conf file with AWS’s DNS servers. Editing the /etc/resolv.conf file isn’t recommended as it would get regenerated when the DHCP lease time expired.

The answer is to define a new DHCP options set and apply it to your VPC (Virtual Private Cloud).

Within the AWS web console navigate to the VPC service and select the DHCP Options Set option from the left hand menu. Unfortunately, you can’t edit an existing options set, so you’ll need to create a new one.


Creating a DHCP Options Set


Enter a name for your options set and add up-to four DNS name servers separated by commas. In the example shown above we’ve added the two HSCN IPs first followed by Google’s and Cloudflare’s DNS servers.

Once Youv’e created the options set, navigate to the Your VPC’s section of the AWS web console. Click on the Actions button choosing the Edit DHCP options set menu option.


Applying a DCHP Options Set to a VPC


Select your newly created options set and apply it to your VPC. There is no need to reboot the servers as they will pick up the new settings when the DHCP lease time expires.


I hope you found this article useful, you can discuss it on Twitter
I create educational content for developers, hoping to inspire and teach with a deep understanding.

Paul Bradley