AWS Route 53 in 5 minutes

Route 53 is the service behind an AWS-managed application stack or website, which the user will invisibly meet first when they start using the app. Route 53 has various functionalities like domain name registration, authoritative DNS or enabling routing policies. In this post, I will briefly discuss the most important features of Route 53.

In the broad scale of its web services, AWS also provides a way to manage domain names and how to route traffic to them.

1. What is Route 53?

Route 53 is AWS’s DNS service. As most services at AWS it’s fast, reliable and provides high availability through the global network of DNS servers around the world.

Route 53 has many different functions. Let’s talk briefly about the most important ones.

1.1. Domain name registration

Route 53 console provides an easy way to search available domain names and register them.

Route 53 domain registration in the console
AWS domain name registration in the console

If, for some reason, the user chooses to register the domain somewhere else, or they already have a domain registered with another registrar, and they want to manage it with AWS, they can transfer it to Route 53.

The console also displays all domain names that have been registered with or transferred to Route 53.

1.2. DNS service

Route 53 is an authoritative DNS service.

Say that we have an app running under the myapp.com domain. If the user types myapp.com in the browser, they expect the app to appear on the screen fairly soon.

For the sake of simplicity, assume that the app runs on a server (it can be custom built or managed by e.g. AWS or Heroku), which has a public IP address. The public address is unique in the whole world, and it belongs to one and only one resource (the server running the app). So instead of memorizing the IP address of that server, the user simply types myapp.com.

The query has to go through a set of DNS servers to find the one that runs the application. The authoritative DNS is the last step on this network of DNS servers. It has the record on the mapping between the myapp.com domain and the IP address, and can respond to the user query with the content of the application.

1.3. Routes traffic

Route 53 allows multiple routing policies when a record (routing rule) is configured.

Some examples are latency, geolocation, weighted or failover routing.

Latency routing policies can be used when the app is hosted in multiple regions, and it’s required that the traffic should be sent to the region responding within the shortest time.

Classic use cases of the geolocation routing policy are to restrict content in certain countries, display content in a local language, or have traffic served from a specific geographic location, no matter what the response time is.

It can be determined how much traffic is routed to certain resources with the weighted routing policy by adding different weights to each resource.

The failover policy can route traffic to a standby resource in case the primary one has proved to be unhealthy.

The default routing policy is the simple routing, which simply forwards traffic based on the record.

1.4. Manages subdomains

For the app, which runs under the myapp.com domain, multiple subdomains can be set up, such like support.myapp.com or CLIENT_NAME.myapp.com.

When a domain is registered with Route 53, a hosted zone of the same name is created for the domain. Subdomains and the related route rules are all defined in the hosted zone.

For example, support.myapp.com can point to a service instance which runs the support application, while CLIENT_NAME.myapp.com can display client specific content.

1.5. Health check

Route 53 can also perform health checks on the endpoints of the resources the records point to, and route traffic to the instance only if it proves to be healthy.

Health checks are performed periodically on the resources specified in the configuration, but only when no DNS queries are received.

2. Hosted zones

A hosted zone has the same name as the domain it belongs to. It contains all records and routing information for the domain and its subdomains.

Hosted zones can be created automatically by AWS (when the domain is registered in Route 53) or manually (when the domain is transferred to Route 53). When AWS creates the hosted zone, four name servers in different TDLs (top level domains) and the start of authority (SOA; the base information on the domain) are also created. They should not be changed.

Once the hosted zone is set up, we can create the records for the domain (apex) and its subdomains (if any). For example, the domain can be redirected to the public IP address of an EC2 instance from where the application is served.

Or, latency routing policies can be set up if the application is served from, say, two regions. In this case, two additional myapp.com records will point to the regions represented by subdomains (e.g. europe.myapp.com and us.myapp.com). These subdomains can then point to the IP address of a load balancer or server running in each region.

3. Record types and aliases

Route 53 supports multiple record types: A, AAAA, CNAME or MX, just to name a few. These records are standard DNS records, and their use is not restricted to AWS.

On the other hand, alias records are AWS specific, and unlike CNAME records, they cannot point to external resources.

With alias records, traffic can be redirected to specific AWS resources (like S3 or load balancer) or to other records in the same hosted zone. In this respect, they are similar to CNAME records with a few differences, but these will be the subject on another post.

4. Conclusion

Route 53 is a very important part of the AWS stack in managing applications.

It provides an interface to register domain names. Route 53 is also an authoritative DNS, which has the record of the unique IP address belonging to the domain name.

Hosted zones contain the records and routing rules for a specific domain and all of its subdomains. Route 53 also allows various routing policies, with which the account owner can influence how the traffic is served.

Thanks for reading and see you next time.