Accessing anything on the internet is not as simple as typing a web address and hitting enter. Although you get the desired content in your browser in a fraction of a second, there is a lot that happens even before your actual request is served. The Internet is not magic, and it is not easy to maintain a directory of millions of web addresses in a way that every request to a website brings back the correct website content every time.
Domain Name System (DNS) is a system that maintains the directory of web addresses. Consider an example website “example.com”, which is not exactly understood by any machine. Machines understand binaries, thus it is important to convert these names which make sense to humans, to something that is understood by machines. This is done by DNS servers.
DNS servers are responsible to translate web addresses (domain names) into unique IP addresses understood by browsers to make valid HTTP requests. Route 53 is a DNS service provided by AWS that also performs tasks like domain registration, DNS m
DNS servers are responsible to translate web addresses (domain names) into unique IP addresses understood by browsers to make valid HTTP requests. Route 53 is a DNS service provided by AWS that also performs tasks like domain registration, DNS management, traffic flow management, and Health checks. We will take a look at these topics in this post.
In general, when an HTTP request is made to a website using its domain name, the following happens:
- Requests made via a browser are first received by a DNS resolver.
- DNS resolver forwards the address requested to one of the publicly available DNS servers.
- DNS Servers respond with the IP address associated with the address.
- The browser then uses this IP address to trigger the actual HTTP call to the webserver of interest.
- The web server responds with the desired content.
Domain names are used by end-users to identify specific web addresses. Domain names are registered by domain registrars into the domain registry. Usually, a company that owns the domain registry is called a domain registrar. Companies that help domain registrars sell the domains are called domain resellers. These are certain concepts to keep in mind while working with DNS management.
Amazon Route 53 enables users to register their domains either by buying a new one or migrating an already bought one to Route 53. In case of migration, care should be taken to manage the transfer of name servers as the website may already be serving live traffic.
Route 53 also offers a DNS management service. We need to create a hosted zone in Route 53 for the given domain. Hosted zones manage the DNS records. By default DNS records of type NS and SOA are created with a simple policy and the traffic is routed to Route 53 name servers. We can create additional DNS records of various types (A, AAAA, MX, etc) and specify the target resource (IP) for routing the incoming requests to appropriate hosts.
Hosted zones are of 2 types – based on where the traffic originates from. If we want to route traffic originating from the internet to our VPC then we make use of public hosted zones. However, if the traffic originates from the VPC itself – e.g. EC2 instances, databases, or any other resource placed in VPC, private hosted zones can be used.
DNS records created in private and public hosted zones help route the request traffic to appropriate resources depending on the call made to any domain or subdomain. In private hosted zones as well we need to provide a domain name. This domain name needs not to be registered. In this way, you can have your own facebook.com internal to your network.
Let’s say we need many subdomains so that the incoming traffic can be routed internally based on the request made to a particular subdomain. Huge hierarchies of subdomains can get tricky to manage. Route 53 provides a graphical way to manage the same. Using traffic flow, you can create a workflow that starts from an origin and ends in an endpoint. The endpoints here are the resources placed in VPC e.g. EC2 instances, databases, Elastic Beanstalk, etc.
In between, we can build the routes by making use of rules as below, before the request reaches the destined endpoint.
- Weighted rule
- Failover rule
- Geolocation rule
- Latency rule
- Multivalue answer rule
- Geo Proximity rule
Route 53, when used in VPCs, uses a default Resolver. Resolver helps route the requests based on the domain names assigned to internal resources. A given network may contain multiple DNS resolvers. When a request travels from one end (with a different resolver) to a resource in a VPC, the request is first received by a Resolver and then forwarded to the resource in VPC.
However, for the Resolvers to work and based on where the traffic originates, inbound/outbound endpoints should be created. These endpoints provide a path for the requests to reach the respective Resolvers.
One of the most used functions of Route 53 is to route internet traffic to the appropriate AWS resources. When application APIs are hosted on Amazon API Gateway, incoming requests or API calls can be configured to be sent to Amazon API Gateway. Similarly, the traffic can also be configured to hit EC2 instances, Elastic Beanstalk, Load balancers, RDS databases, S3 buckets, and Amazon WorkMail.
Route 53 also performs health checks of the resources by monitoring the performance of web servers, applications, and other resources. It can also monitor the status of the AWS CloudWatch alarm. With the help of redundancy, failover settings can be configured. In case if one of the resources turns unhealthy, the traffic can be routed to another healthy resource based on the health check.
That was a brief introduction to Route 53. Of course, the posts in these blog series are not meant to recreate AWS documentation. These posts intend to provide a flying overview of what this service is. If you like the content, consider subscribing, following, and sharing this blog post!