Amazon Route 53 is a DNS (Domain Name Server), which is high available and can be scaled according to the requirements. DNS is a distributed service which is present all over the world, that helps people use the internet. It uses hierarchical structure, thereby keeping a clear bifurcation between the levels. It is usually used to perform the below three operations:
When the user’s website requires a name, route 53 can be used to provide a domain name for the website and register it. This is done by first searching for the domain name (make sure it hasn’t already been taken by others), register this domain name with route 53, provide details of the domain owner, and then Amazon (or Gandi, which is Amazon’s registrar associate) sends information regarding the domain to the registrar.
This registrar sends the domain owner’s information to the domain’s registry. Registry is an organization which sells domain registrations to top-level domains, like .com. The registry further stores information regarding the domain in its own database.
The route 53 helps connect the browser to the user's website or application. When a user sends a request to a website (domain or subdomain), this request needs to be routed to the right address to get the relevant response. This is taken care of by route 53.
Configuring route 53 to route requests:
- The domain name is registered and once this is done, route 53 created a publicly hosted zone automatically. This zone has the same name as that of the domain name.
- The user creates ‘records’, which helps route traffic/requests from users to the user’s resources. These records are also known as ‘resource record sets’, which are present in the publicly hosted zone.
- Every record’s name present in the hosted zone should end with the hosted zone’s name, which is done automatically for the user by route 53.
- Every record has the below information, that helps route traffic to the specific domain:
Name: This corresponds to the domain or subdomain name; whose traffic needs to be routed with the help of route 53.
Type: It helps determine the type of resource which has to be used to route the traffic to. For example: Routing a traffic to a web server which has an IPV4 address, requires an A type, whereas routing traffic to an email server requires an MX Type.
Value: This is similar to Type, which specifies the name of the resource to which the traffic is routed to.
Routing traffic to a user domain:
- When the user enters a domain name, and clicks on enter, this request is routed to a DNS resolver, which is managed by the user’s ISP (Internet Service Provider).
- This DNS resolver forwards the request by the user for the specific domain name to a DNS root name server.
- It also forwards the user request to TLD name services (a .com domain).
- The name server for the domain responds to this request by providing 4 route 53 name servers, which are associated with that specific domain.
- The DNS resolver stores these four routes 53 name servers and behaves like a cache, so that if the same user or any other user requests for the same domain, it can be easily fetched from the cache, instead of resolving the domain name.
- This cache stores information for only 2 days, post which data is refreshed to store more recent name servers.
- The DNS resolver chooses one of the 4 name servers and this is forwarded to that name server (to which the user originally sent a request).
- This name server looks for the record in the hosted zone of the domain name, and fetches the value associated with it (IP address).
- This address is returned to the DNS resolver, which will have the IP address required by the user.
- It returns this to the web browser, which sends a request for the name associated with that IP address.
- This is the location where the content is stored, that the user needs.
- The resource (usually a web server) returns the web page associated with that IP address to the web browser so as to be shown to the user.
Route 53 is also responsible in sending automated requests to a resource through the internet. This is done by route 53 to make sure that the web server which is serving user requests is available, functioning properly and reachable. There is a facility in route 53 which allows enabling the notifications which inform the user when a specific resource fails or becomes unavailable. This way, the user can route the requests to other available resources.:
- It can be created by specifying values which allow different kinds of health checks to be done. Below are a few of the values which could be specified:
- IP address or domain name of the endpoint (the web server which has to be monitored by the Route 53).
- The request interval: This tells about the frequency of route 53 sending a request to the endpoint.
- Protocol: The set of rules which the user wants route 53 to use to perform the health check, whether it should be HTTP, HTTPS, or TCP.
- Failure threshold: The number of times that the endpoint fails to respond to the request continuously before it can be deemed unhealthy or unavailable by route 53.
- When an endpoint is unavailable or unhealthy, it is detected by route 53. Notifications can be enabled to notify the same. This is done by setting a CloudWatch alarm (which is done by route 53 automatically). Amazon SNS is used by CloudWatch to notify users about an endpoint’s health.
Note: The status of other health checks can also be monitored.
- A health check interval is provided so that at this interval of time, route 53 sends request to the endpoint to perform a health check.
- When the endpoint responds to the request sent by route 53, it is considered as a healthy endpoint, and no further action is taken.
- If the endpoint doesn’t respond to a request, route 53 starts sending consecutive requests and keeps a count of the number of requests which are continuously sent to the endpoint:
- A failure threshold is pre-defined and when the count reaches the failure threshold, route 53 considers such an endpoint to be unhealthy.
- If the endpoint responds before the count reaches the failure threshold, the count is reset to 0 by route 53.
- If the endpoint is deemed unhealthy by route 53, this is notified to CloudWatch by route 53 (if it was configured to provide a notification when the endpoint is unhealthy).
- If the configuration to provide a notification wasn’t done, the status of the route 53 can be still be checked in the route 53’s console.
- If the notification is configured for a health check, CloudWatch triggers an alarm to indicate about an endpoint not being healthy, with the help of Amazon SNS, and sends it to the respective user.
Note: In addition to this, the health of a health check can also be monitored, and configured to provide notifications. The status of a CloudWatch alarm can also be monitored, to keep a tab on a wide range of specifications, not just a resource responding/not responding to requests.
In this post, we understood the importance of route 53, how it works, and how it can be used to cater to multiple user requests to a domain name.