AWS Route 53 and Routing Policies

Crishantha Nanayakkara
4 min readApr 26, 2021

--

[Part 01 — Domain Registration and creating a Record Set]

This blog will discuss how we can leverage AWS Route 53 to register a Domain and to do a simple routing by creating a “A” Record Set.

What is Route 53?

Route 53 is highly available and scalable cloud Domain Name System (DNS) web service. It is designed to give developers and businesses an extremely reliable and cost effective way to route end users to Internet applications. It is fully compliant with IPV6 as well.

However, it is more than a DNS service, which can basically do:

  1. Domain Registrations
  2. Handling Fail-over between regions

Finding Details about a Domain

Before you start creating a Domain, it is always important to check its existence. You can use many web services available on the Internet or if you are Linux/ Mac user, you can use the “dig” command to query it further.

The “dig” command is a tool for querying DNS name servers. This can be executed only on Linux and Mac machines.

$ dig “crishantha.com”

This command will give you the following information:

A (the IP address), TXT (text annotations), MX (mail exchanges), NS name servers.

$ dig +trace “crishantha.com”

This command will give an additional “trace” on how it approaches the final destination on finding the “authoritative” response of finding the DNS Name Servers.

Registration a Domain using Route 53

As mentioned above, we can use Route 53 to create the Domain that you need. The following steps are involved in this process (See Figure 01).

While registering the domain, a “hosted zone” and two record sets related to the hosted zone are created along with the domain.

  1. Go to “Route 53” Dashboard
  2. Under “Register Domain” search for a Domain that you want to register and click “Check” button. If it is available add that to cart and proceed the check out. This will trigger the Domain registration and will take some time to complete the process. You may see the request under the “Pending Requests”
  3. Go to “Hosted Zones”. You will see a hosted zone created with the same name as of the domain name.
  4. Click the created hosted name. You will see NS (Name Server) records and a SOA record were created with the Domain registration.
Figure 01 — Domain Registration Steps with Route 53

Adding a Record Set to the Hosted Zone

Once the Domain was registered using Route 53, you may add an “A” record as the first routing entry via “Hosted Zone”.

Step 1: Create an EC2 instance and install Apache on it with a dummy “index.html”.

Step 2: Map the public IP address of the EC2 instances as the “A” record.

Click “Create Record Set” button under the selected hosted zone to create an “A” record.

There are multiple record set types available here.

A Record — Maps a domain name to an IPV4 IP address

AAAA record — Maps a domain name to an IPV6 IP address

MX record — Provides the mail servers for a given domain

NS record — Sets the authoritative servers for the domain

TXT record — Some text to validate the domain. This could be used domain ownership verification as well.

Figure 02 — Creating a “Record Set”

Adding an “A record” or a “CNAME record”

Alias Record — An “A” record can be a “Alias” or “Non Alias”. The “Non-Alias” record endpoints are IP addresses. “Alias” records are pointed to AWS specific resources such as Load Balancers, S3 buckets, API Gateway Endpoints, VPC Endpoints and CloudFront distributions.

Figure 03 — Adding an “A” Record with Non-Alias

CNAME Record — CNAME record can only be used for non-ROOT domain names such as www.mydomain.com. Alias can be used foe both ROOT and non-root domains such as mydomain.com and www.mydomain.com.

Figure 04 — Adding an “A” record with an “Alias”

If all okay, you may try to test your newly registered domain with an EC2 instance mapped as your “A” or “CNAME” record. It should work fine!

In the part 02 of this AWS Route 53 series, I will explain how we can leverage Routing scenarios.

Thank You!

References

  1. How to use “dig” command in Linux — https://www.hostinger.com/tutorials/how-to-use-the-dig-command-in-linux/
  2. AWS Route 53 and Routing Policies — Part 02: https://crishantha.medium.com/aws-route-53-and-routing-policies-b7dc67e74516

--

--

Crishantha Nanayakkara

Enterprise Architect | Consultant @ FAO (UN) | Former CTO, ICTA Sri Lanka