Understanding route53 Alias records

May 23, 2020 · 3 min read

   aws

Good documentation + Handson = ❤

What is route53 ?



It is Domain Name System(DNS) provider by AWS. More info from aws official link.


DNS record types


There are more than 20 type of dns records below are few which are heavily used

A => IPV4 address(s)
CNAME => Canonical Address or simply, address pointing to other CNAME(s) or A record(s)
MX  => Mail Exchange Server
AAAA => IPV6 address
...
route53 supports following DNS record types


Now you may wonder how we can use multiple record(s) ?
www.playground.com  A       192.168.2.22
                            192.168.2.23

app.playground.com  CNAME   www.playground.com
                            playground.com

We can use multiple records and querying the DNS will result in any one of the entry randomly being picked(order is random) this can act as cheap load balancer, though not ideal in critical application because if server listening on 192.168.2.23 is down/ unhealthy, DNS will still can randomly resolve that ip.


AWS Non Alias Records


  • They are simply DNS records (A,CNAME,MX, .. ) that we do for any DNS servers

  • below I have added one A record and 2 CNAME records


Lets verify the DNS entry by issueing dig unix command, here’s wiki on dig

  • A record
➜  route53 git:(master) ✗ dig www.playground.com @ns-517.awsdns-00.net.

; <<>> DiG 9.10.6 <<>> www.playground.com @ns-517.awsdns-00.net.
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58114
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.playground.com.		IN	A

;; ANSWER SECTION:
www.playground.com.	300	IN	A	192.168.0.1
  
;; AUTHORITY SECTION:
playground.com.		172800	IN	NS	ns-1505.awsdns-60.org.
playground.com.		172800	IN	NS	ns-1910.awsdns-46.co.uk.
playground.com.		172800	IN	NS	ns-441.awsdns-55.com.
playground.com.		172800	IN	NS	ns-517.awsdns-00.net.

;; Query time: 30 msec
;; SERVER: 205.251.194.5#53(205.251.194.5)
;; WHEN: Sat May 23 15:43:05 IST 2020
;; MSG SIZE  rcvd: 200
  • CNAME record
  • CNAME record

Note: we are using AWS nameservers, though we can also use Google’s DNS 8.8.8.8

ns-517.awsdns-00.net. 
ns-1505.awsdns-60.org. 
ns-1910.awsdns-46.co.uk. 
Ns-441.awsdns-55.com.

AWS Alias Records


Alias records in AWS are records which points to some AWS recources like

  1. S3 bucket
  2. Load balancer
  3. Cloudfront etc

This is full list of entries we can have for Alias records


Below I have added Alias A record to load balancer

which end up looking


If we dig www.playground.com we will endup resolving IP of the loadbalancer, lets verify


one of thing I didn’t discussed was health checks that Route53 DNS provides, which basically means if the evaluated IP is not healthy (depends if health check is set) Route53 DNS server won’t resolve to that IP.. anyways topic for some other day


Thats all for today, This is AWS guide to choosing Alias/Non Alias records


comments powered by Disqus