AWS Route53 — Records & Routing Policies
In this article, I’ll talk about one of the most used service, AWS Route53.
So what is Route53, What is use of it? Why we use it?
Before we start with Route53, let’s understand what is DNS(Domain Name System)
As we all use internet, so obviously we have used DNS. DNS is used to convert domain names (like http://medium.com) into an Internet Protocol IP address such as (http://87.193.63.1)
We have two types of IP addresses IPv4 (32 bit field, apx 4 billion different addresses)& IPv6 (128bits).
if you want to know how DNS name resolves query, please check my below blog on same.
Let’s head over to our main topic i.e Route53.
In AWS, Route53 is global managed DNS (Domain Name System) & we already know DNS is a collection of rules and records which helps clients understand how to reach a server through URLs.
DNS operates on port 53. Amazon decided to call it route 53 so that’s where the name comes from.
It’s a global service. You need to buy a domain in order to work with Route53, Go to Route53 Service & Click on register domain. Enter the domain name & check availability, Add to cart & click on continue.
Route53 can use basically:
- Public domain names you own (or buy) or Private domain names that can be resolved by your instances in your VPCs.
- Route53 has many features such as Load balancing, Health checks, Routing policy like Simple, Failover, Geolocation, Latency, Weighted, Multi value.
- You pay $0.50 per month per hosted zone.
In AWS Route53, we have many types of records. Let’s talk about various records.
1- SOA (Start of Authority Records)
Basic SOA stores information about below things.
- Name of Server that supplied the data for zone.
- The administrator of that zone & current version of data file.
Eg:
ns-2048.awsdns-64.net. hostmaster.example.com. 1 7200 900 1209600 86400
Route53 Name server that create SOA record: ns-2048.awsdns-64.net.
Email Address of Administrator: hostmaster.example.com
2- NS Record (Name Server Records)
NS records is basically your name server records which are used by top level domain servers to direct traffic to content DNS server which contains the authoritative records.
So whenever we create a hosted zone in Route53, Two types of records automatically created, one is SOA & second is NS.
Before we head over to important type of records used in AWS, let’s talk about one important concept TTL(Time to Live)
TTL (Time to Live):
TTL is mandatory for each DNS record. So TTL is length that a DNS records is cached on either the resolving server or user own Laptop. The Lower the TTL, the faster changes to DNS records. Whenever you created record set, you need to define TTL for it.
Let’s talk about the most common records in AWS.
When you create basic records, you specify the following values.
- Name
- Type
- Alias
- TTL (Time to Live)
- Value
- Routing Policy
1- A Record ( URL to IPv4)
The “A” record stands for Address record. The A record is used by computer to translate the name of the domain to an IP address.
Eg: (http://medium.com might point to http://126.78.98.90)
2- CNAME (Canonical Records- URL to URL)
CNAME Points a URL to any other URL. (gaurav.gupta.com => gkg.example.com), We use it only for Non-Root Domain(aka. something.mydomain.com)
3- Alias Record:
Alias record points a URL to an AWS Resource, Alias record are used to map resource record sets in your hosted zone to Elastic Load Balancer, CloudFront or S3 Buckets websites.
4- AAAA: (URL to IPv6)
An AAAA record maps a domain name to the IP address (Version 6) of the computer hosting the domain. An AAAA record is used to find the IP address of a computer connected to the internet from a name.
5- MX Record (Main Exchange Record)
A mail Exchanger record (MX record) specifies the mail server responsible for accepting email messages on behalf of a domain name. It is a resource record in the Domain Name System (DNS). It is possible to configure several MX records, typically pointing to an array of mail servers for load balancing and redundancy.
This is all about various type records, let’s talk about Routing policy. So what is routing policy.
When you create a record, you choose a routing policy, which determines how Amazon Route 53 responds to queries.
There is total 6 types of routing policy in Route53, let’s talk about one by one.
1- Simple Routing Policy:
In case of simple routing policy, you can have only one record with multiple IP addresses. If you specify multiple values in record, Route53 returns all values in random order to the user.
Maps a domain to one URL, Use when you need to redirect to a single resource. You can’t attach health checks to simple routing policy. If multiple values are returned, a random one is chosen by the client.
2- Weighted Routing Policy
Weighted Routing Policy controls the what percentage % of the requests that go to specific endpoint. It’s helpful to test 1% of traffic on new app version. It is also helpful to split traffic between two regions. We can associate Health checks with it.
3- Latency Routing Policy
It allows you to route your traffic based on lowest network latency for your end user. It redirects to the server that has the least latency close to us also helpful when latency of users is a priority. Latency is evaluated in terms of user to designated AWS Region. For example: Germany may be directed to the US (if that’s the lowest latency)
4- Failover Routing Policy
Failover routing lets you route traffic to a resource when the resource is healthy or to a different resource when the first resource is unhealthy. The primary and secondary records can route traffic to anything from an Amazon S3 bucket that is configured as a website to a complex tree of records.
You can associate health check with this type of policy.
5- Geo Location Routing Policy
Geolocation routing lets you choose the resources that serve your traffic based on the geographic location of your users, meaning the location that DNS queries originate from. For example, you might want all queries from Europe to be routed to an ELB load balancer in the Frankfurt region.
This is routing based on user location. Health check associated.
6- Multi Value Routing Policy
It helps distribute DNS responses across multiple resources. For example, use multivalue answer routing when you want to associate your routing records with a Route 53 health check.
Use multivalue answer routing when you need to return multiple values for a DNS query and route traffic to multiple IP addresses. Up to 8 healthy records are returned for each Multi Value query. Multi Value is not a substitute for having an ELB.
This is all about Route53 & it’s records & policy.
Hit clap button if you find it useful.
Happy Clouding :)