DEV Community

Gokul Kannan
Gokul Kannan

Posted on

AWS - Route 53

As we discussed about DNS, we can maintain our DNS in different DNS management services.

In AWS, we have DNS management service called Route 53

Lets say we already own a domain in wordpress for example "gokulkannan.com"

Lets say we can spin a EC2 instance and run index.html. Then the IPV4 of EC2 can be exposed by using the A record.

And this A record can be updated inside one of the Hosted Zone inside Route 53.

Now lets say if i type "abc123.gokulkannan.com" it should hit the index.html maintained in the above created EC2. So, how do we do this. We will see that in detail.

But we have two different groups one is the wordpress and this route 53. How these two get connected.

That is using the NS - Name Server. As soon as we create a Hosted Zone in Route 53, there we will be having a Name Server. We will give that NS configuration in the wordpress.

So, the flow goes like
DNS in browser --> .com --> gokulkannan.com--> NS-->it comes to Route 53's zone there we would have give the A records, here it resolves.

Now lets create a Hosted Zone in Route 53

A hosted zone is a container that holds information about how you want to route traffic for a domain, such as example.com, and its subdomains.

Now here it would create a NS and SOA (metadata about he zone file) records by default. Now this NS servers can be used in any other DNS zone records for example if "gk-space.com" is hosted in Wordpress, then there in that DNS zone file, i can add a NS record and map the subdomain "abc123.gk-space.com" with the NS servers provided in our hosted zone in Route 53.

Now already i had created EC2 instance and a load balancer. Now i have created a hosted zone in Route 3, there i need to add a "A" record with load balancer's public IP, so that i can hit the domain to hit the load balancer. But In AWS, you generally won't find a single fixed public IP address for an Application Load Balancer (ALB). Instead, AWS provides a DNS name for the load balancer. You should use that DNS name in Route 53 rather than trying to find its public IP.

Create an A record in Route 53

Since you already created a hosted zone, follow these steps:

Open Route 53 → Hosted zones.

Select your domain's hosted zone.

Click Create record.

Configure the record as follows:

Field Value
Record name Leave blank for the root domain, or enter www
Record type A – IPv4 address
Alias Enable (Yes)
Route traffic to Alias to Application and Classic Load Balancer
Region Select your load balancer's AWS Region
Load balancer Select your load balancer's DNS name
Routing policy Simple routing

Top comments (0)