Below are my notes on the AWS service Route 53. Route 53 is the AWS DNS service. It’s named after port 53 which is the DNS port. Route 53 is not a regional service it is set up on the Global region only. It’s more commonly used for public domain names but can also be used for private names in VPCs.
Before we get into the details of Route 53 it’s good to have a background in DNS. DNS is like a phone book for the internet, it translates domain names into IP addresses. The most common IP addresses are IPv4 which are 32bit and capable of up to 4 trillion addresses. IPv6 addresses are also now available and these are 128 bit and capable of many many more addresses.
Domains are registered with interNIC a service of ICANN. The top-level domain, .com, is controlled by Internet Assigned Numbers Authority (IANA).
The main DNS record types are:
SOA – Start of authority. This contains details about the domain such as the primary name server, the owner, the last update date and details for how often servers need to refresh their information about the domain. Each DNS Zone contains a single SOA record.
NS – Name Server. NS records are used to tell traffic where your servers are located. You can have multiple Name Server records for redundancy and the records will be propagated around the internet.
A – Address. The Address record translates a name into IP addresses. You may have multiple addresses for a domain name which correspond to the sub-domains. For example, www.mydomainname.com, blog.mydomainname.com etc. each with a different IP address and a separate A Record.
TTL – Time To Live. The time for which a DNS record should be cached i.e. how long before a server refreshes its DNS records. Lowering the TTL will make domain name changes apply faster.
CName – Canonical Name. A record used to translate one domain name into another i.e. to treat one name as an alias of another. Canonical names consist of addresses like www.mydomainname.com and ftp.mydomainname.com which both point to the A record mydomainname.com. Only the A-record points to the ip address. CNames cannot coexist with other records so if you have blog.mydomainname.com pointing to an A record you may not also have a Mail (MX) record pointing to @blog.mydomainname.com.
Alias – A type of A-Record which points to an AWS resource e.g. a CloudFront distribution, ELB Load Balancer, S3 Bucket, or another Route 53 record in the same hosted zone. Similar to a CName but for AWS resources. In AWS you should always use an Alias over a CName.
When setting up an alias you can choose from a number of Routing Policies. These are:
- Latency, allows you to route your traffic to the site with the lowest latency
- Failover, used for an active/passive set up
- Geolocation, routing based on the geographic location from which the queries originate
- Weighted, splits traffic based on weights
- Simple, 1 to 1 routing
There is a limit of 50 domain names which you can manage in Route 53. This can be increased by contacting AWS.
Route 53 can be set up to perform Health Checks and automatically failover to other regions. Standard Health Checks are every 30 seconds or, if you’re willing to pay extra you can get Fast checks every 10 seconds. Health Checks work by checking for a response or searching for specific text in the response.
To set up a Health Check, create two A records pointing to different instances. The A records must have the same names e.g. www2.mydomainname.com. Set one record as the Primary and one as the Secondary. Set the Routing Policy and Failover and associate a Health Check on the Primary record.