Route53, why I need to know it?
Tags: aws, route53, dns
Published: 2020-05-04 19:03:31

Let's try to figure out what it is and start from the name. What is this _route_ and why it _53rd_? After looking into the Cambridge Dictionary we know that Route is a particular way or direction between places and also a method of achieving something. Number 53 - it is because port 53 is a TCP / UDP reserved port for hosting DNS service. Ok.

Why do we need this service, how do we use it? Turning to the official documentation, [**Amazon Route 53**](https://aws.amazon.com/en/route53/) is a highly available, scalable, cloud-based domain name system (DNS) web service. So what is DNS?

If we try to say simpler, **DNS** is a system that, using an incoming domain name that is convenient for users to perceive (for example, www.dev.to), finds and gives the corresponding IP address that is understandable to the machine.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ntclv349lbiqpyc87i72.png)

There are you can find a few different services like you can buy the domain name or set up some traffic flow (advanced feature for hard skilled developers and big projects). But for me, the main functionality that I need to know is of course **Routing Policies** and for a complete understanding of how Route53 works and why we need it, we need to consider all the options.
And we start to move from simple to hard.

* **Simple Routing Policy** is the simplest Routing that allows you to associate a single domain name with several IP addresses. This is necessary if you have, for example, a site and want to reduce the load on the server where this site hosted - it can be flooded on several servers (for example, even in different regions for greater reliability). And then Route53 will give your browser content from IP addresses from the list randomly. Moreover, if you want to increase the likelihood of a source server change for the user, you can lower the TTL (time to live) parameter so that the browser cache is more frequently updated.

* **Weighted Routing Policy** - overall similar to Simple but with a slight improvement. We can set the percentage of traffic that we want to forward to each IP address. For example, we have two IP addresses (servers) - in Ireland and Frankfurt. We put 80% and 20% weight respectively for these regions and Route53 will deliver content from Ireland with a probability of 4 out of 5. Again, do not forget about the cache and TTL. Also, a convenient function will be to configure [health checks](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-complex-configs.html) that will allow Route53 to disconnect from the routing those IP addresses that have stopped responding.

* **Latency Routing Policy** - even smarter routing based on the speed of server response to a request from a client. Here we can even more finely configure which server on which IP address will respond to a particular client based on the shortest response time. To summarize, this implies that we raise the number of instances that we need in the regions where our users are located and fine-tune Route53 more accurately for each instance for each region. Of course, for these purposes, I most often used [AWS Cloudfront](https://aws.amazon.com/en/cloudfront/), but this service is more suitable for access to static content, and overall this is not such a flexible solution.

* **Failover Routing Policy** - the reasons for using this type of routing are very similar to the case when we raise the RDS instance in several availability zones. There is an active (primary) IP address (server) and passive (secondary) IP address (server). As soon as the primary address stops responding to the health check Route53 switches all requests to the secondary server. This increases the accessibility of our site and the users will be happy. 

* **Geolocation Routing Policy** - first view very similar to Latency Routing Policy, but now we tightly bind a specific region to a specific server. Now we separate, for example, Europeans and Americans, and upon request to the domain name of our site we can show them completely different content from different IP addresses.

* **Geoproximity Routing Policy** (Traffic Flow Only) is a type of routing that allows you to build very complex and flexible routes based on the location of not only users but also requested resources. We can use it only in combination with the Traffic Flow configuration.

* **Multivalue Answer Policy** is a very simple configuration, very similar to Simple Routing, but with one big difference. Now we can configure several record sets and configure a [health check](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-complex-configs.html) for each. Now Route53 will take into account whether each server is alive and exclude it from the random choice in case of a negative answer. Also, this option is very similar to the Failover Routing Policy with the difference that here we do not have active and passive servers, and all servers are equivalent to each other.

------

Of course, this is more like marginal notes, but for better understanding and memorization, I recommend everyone do something like this.