Route 53 Private Hosted Zone and DNS resolution within VPC

Sourav Karmakar
3 min readNov 14, 2021

--

We have the below architecture in AWS, where two EC2 instances can communicate with each other by their private DNS name.

The architecture consist of below components:
1. VPC with two subnets. (one public subnet, another private subnet)
2. Two EC2 instances. (a. primary-ec2 on the public subnet, it has public IP.
b. secondary-ec2 on the private subnet )
3. Route 53 Private Hosted Zone.

You can follow this tutorial to setup the VPC and EC2 instances -

Let’s setup the Private Hosted Zone :

Before you create the Private Hosted Zone, make sure that your VPC has both the DNS hostnames and DNS support options enabled.

Step 1: Go to the AWS Console> Route 53> Hosted Zones.
Step 2: Create a new hosted zone.
Step 3: Provide the domain name and description, choose Private Hosted Zone, select the region where your VPC resides and select the VPC ID.
Step 4: Click on create hosted zone.

Route 53 Private Hosted Zone Configuration

Step 5: Add A records for the EC2 instances.

Get the Private IP of primary-ec2. Provide a Record name, select Record type ‘A’, put the Private IP on the Value, set TTL and select ‘Simple routing’ as the Routing policy.

Similarly add another A record for the secondary-ec2.

Now, it’s time to check.

Log into the primary-ec2 and do nslookup with the secondary-ec2’s private DNS name. You should get the private IP address of the secondary-ec2 as shown below.

Or you can ping the secondary-ec2 by the DNS name (secondary-ec2.demopvtzone.com) from the primary-ec2. (Make sure that you have ICMP protocol enabled in the Security Group Inbound rules of the secondary-ec2)

— — — — — — — — — — — — — — — — — — — — — — — — —

Thank you for reading this. Have a great day.

Here are some other tutorials you may like -

--

--

Sourav Karmakar
Sourav Karmakar

Responses (1)