What is Route53 in aws

Amazon route 53 is a DNS/Registrar service provided by Amazon. A DNS in general is a system that translates your domain names into IP addresses. It’s a collection of rules and records that will basically help client (example: browser) understand how to reach a server through URLs. So it’s routing clients to final addresses.

For example www.google.com. It is mapped with certain IP addresses. If you ping google.com you will get an IP address. How this domain has been resolved to this IP address? This is where your DNS comes into the picture. Because it is not possible for someone like us to remember IP addresses for all these websites, so that’s where we keep a one specific name for our website. And that name is mapped with the IP address for example Facebook, YouTube, Yahoo all these websites we remember easily but we cannot remember their IP addresses.  

Functions of Route53

  • DNS Management
  • Domain Registrar
  • Health monitoring
  • Deciding Routing Policies

DNS Management

In a typical DNS we have a DNS file which contains several types of records, similarly we have a Hosted zone in AWS Route53.

Hosted Zone

Hosted zone is a collection of records for a specific domain. It works as a container for different types of records for a domain.

We can create 500 Hosted zones and 1000 records per hosted zone by default.

We can create multiple hosted zones with the same name, but its NS records will be different.

There are two types of Hosted zone.

Public Hosted Zone

It contains records for a domain which want its traffic to be routed to internet.

Private Hosted Zone

It contains records for a domain which want its traffic to be routed only inside a VPC.

Records in Route 53

Any Hosted zone contains NS records, SOA, ANAME Record, AAAA record, CNAME Record, MX Record.

ANAME Record

These are also called Host records. These records link IPv4 address to domain name.

AAAA Record

Quad A record perform same function as of ANAME Record except for IPv6 addresses.

Why there are 4 As? Because there are 32 bits in IPv4 and in IPv4 there are 128 bits. So 32*4=128

So AAAA is 4 times A.

CNAME Record

Canonical Name record or Alias Name Record.   We can map an Alias to a hostname with this record. We can even map a load balancer with an alias through this record. We tell the DNS through this record that if some client query www.blogbells.com it will redirect it to blogbells.com.

some examples are: www.blogbells.com, support.blogbells.com.

It never contains an IP address.

We can create CNAME record for a subdomain of a domain but not directly for a domain. OR we can say that we can not create a CNAME record for a root domain.

We cannot create same CNAME records in a hosted zone with two different values.

NS Record

NS records are something that are stored with your domain name registration company or we can say with your registrar.

NS record will tell you where to find name servers for your domain.

Name Servers (can be with any company) keep track of DNS record. DNS Records (Stored on Name servers) keep track of the IP addresses where you want to send the traffic for your domain and subdomain.

Name servers are unique globally.

SOA Record

Start of Authority record. It is the first record created automatically whenever a hosted zone is created. There can be only one SOA record in a hosted zone and you cannot create it manually in Route53. This record contains information about the hosted zone like:

Contact email: ex: awsdns-abcd.amazon.com

Hosted zone is hosted on which server: ex: ns-1111.awsdns-25.org

Refresh, retry and expiration time.

Minimum TTL

MX Record

This record is used to send e-mails to a domain server.

In any hosted zone 1 SOA and 4 NS records gets created automatically at the time of creation of Hosted zone.

We don’t change SOA. And usually we don’t change NS records.

Route53 as Domain Registrar

These are the companies’ which provide us the Domain names or we can say from whom we purchase the domain names.

Whenever we register a domain with Route53, AWS creates a hosted zone automatically.

The name of the domain and name of Hosted zone would be same.

AWS provide two types of Domains:

  1. Generic top level domain: .com, .org, etc.
  2. Geographic top level domains: .us, .in, .au

If you want any other type of domain you will have to go to other registrars like godaddy, or google etc and you can use these with Route53. But in that case you will have create the hosted zone manually.

Health Monitoring in Route 53

Route53 keeps checking the health of a server by sending them request on timely basis. If a Webserver is not in healthy state, Load Balancer will know it and send this information to Route53.

If there is no ELB between a server and Route53 then it will check the health of instance itself and will not send the traffic to unhealthy server.

Routing Policies of Route 53

whenever we create a record we need to choose a routing policy and based on this policy Amazon responds to queries. There are 7 types of routing policies.

Simple Routing

In this routing policy there is one domain and one IP. Whenever there is a request on that domain comes, will be forwarded to the mapped IP.

Failover Routing

There will be at least 2 servers mapped to a domain in this routing policy. These are primary (active) and standby (passive). The request will be always directed to primary (active) server. But in case the primary server is unhealthy the passive will become the active server and requests will go to that. Now if we have implemented the ELB also on servers, a new server will be created and the newly created server become the passive server.

Tom implement Failover Routing Policy you need to create two records which are primary and secondary servers and implement failover policy on both of these.

This policy works only on Public Hosted zone and not on private hosted zone.

Geolocation Routing

The query will be answered on the basis of its origin. The response will be given by the server which is nearest to the client.

For example in India if we open amazon, amazon.in will be opened by default, but in in US it will be amazon.com.

Benefits of Geolocation routing

We can localize the contents based on the location.

We can put the country based restriction on content of a website.

In America we can put these restrictions to Continent, Country, or state wise.

Q: if the region is overlapping then what happens to the request?

Ans: In this case the query will go to smaller region. For example: Canada is on North America and we have created records for North America and Canada both. In this case the query will go to Canada as it is the smaller region.

Q: if it cannot be decided that from the query is originated, which server will respond?

Ans: In this case we maintain a default path and query will be answered from that server and will fail in case if default record is not there.

Multivalue Answer routing

We configure multiple IPs and Route53 itself decide which server to connect for the query

Latency based routing

Routing protocol will connect you to the server which can respond faster. And it does not matter from which region or country the request originated.

Scenario where we use Latency based routing: We have deployed our application in Mumbai and North Virginia. A request originated from US during night IST when there is comparatively much requests originated in US than India. At this time there will be much traffic on US server, so the request can be served from India server as it will be comparatively less loaded and will respond fast.

To implement this we create Latency records for all the regions in Hosted Zone where application is deployed. Now whenever a request comes Route53 will check the latency record to determine the fastest response time. And based on that it will redirect query to the appropriate server.

Weighted Routing

According to this protocol Route53 will send the requests to different servers based on some predefined percentage.

Suppose we have 3 servers A, B, C. We assign weights to these:

A: 4, B: 2, C: 2

Now we calculate the total of weights assigned which is 4+2+2=8

Now the traffic which will go to

A is 4/2*100 = 50%

B is 2/8*100 = 25%

C is 2/8*100 = 25%

Geo proximity routing

In this policy if there is more traffic on a server, then it will be routed to another servers.