exanubes
Q&A

Route 53: Introduction into DNS

This article will cover what is Amazon’s Route 53 service, what are the steps of navigating to a website and clearing up some of the jargon that is often associated with it, such as A Records, DNS, IP, TLD, SOA and more.

Route 53 is Amazon’s DNS web service, which is a collection of rules and records that allows users to reach servers through URLs. It’s a global service, meaning it’s region agnostic. Some of the available records are A, AAAA, CNAME and Alias. In a simplified version, when the user makes a request to visit exanubes.com the browser first makes a DNS request to Route 53 which in turn sends back a response with the A Record IP address. Now the browser can make the HTTP request to the IP that was sent back from Route 53 saying that the host it’s looking for is http://exanubes.com and receives a HTTP Response. Route 53 has some additional features such as health checks, routing policies, load balancing through DNS and allows registering new domains. Name of the service is derived from the Port 53 which handles DNS for UDP and TCP requests.

DNS

DNS is short for Domain Name System which is a collection of rules and records that allow us to reach a server via URLs. In essence it’s Internet’s phone book. Back in the day everyone’s number would be in the yellow pages and you could look up someone’s name and see the number associated with it. DNS does the same thing using domain names. When someone wants to navigate to http://exanubes.com, first he needs to go to the phone book and see which IP address is associated with the domain so he knows which application server to call.

Client side of DNS is called a DNS resolver and all requests go through the Internet Service Provider (ISP) to the DNS resolver of their choosing unless it’s manually set to a different one. When going to http://exanubes.com the browser is sending a request to the resolver and asking what’s the IP for this domain. If the resolver doesn’t have the answer for you in its cache, it will send the request further along to the root-zone name server which will give the resolver address for the server of the TLD. For this website it’s a .com name server which points the resolver, in this case, to the Amazon Route 53 name server. Route 53 sends back the IP address of the application server to the resolver which then sends it back to the browser. Diagram of dns resolver

IP

IP is short for Internet Protocol and they’re addresses used by computers to identify one another on the network. They commonly come in two different forms - IPv4 & IPv6. Most people have seen a IPv4 address. It’s a string of four numbers ranging from 0 to 255 and separated with a dot e.g 192.168.0.10. It’s a 32 bit field made out of four octets meaning each number in the IP address is made out of 8 bits or 1 byte. More on that in an upcoming article. There are over 4 billion IPv4 addresses which is finite considering there’s nearly 8 billion people on the planet. About half of that uses internet and loads of us have multiple devices that are connected. This basically means we’re running out. That’s why IPv6 came about which has an address space of 128bits which is over 340 undecillion addresses - 340 with 36 zeros. It’s made out of eight groups separated by colons (:), each group is made out of four hexadecimal digits. Hexadecimal means it’s a base 16 counting system rather than the decimal we use in our every day life. So digits can range from 0-9 as well as a-f for representing numbers 10 through 15 e.g 2001:0db8:85a3:0000:0000:8a2e:0370:7334. There’s an effort to move to IPv6, however, right now both are being used.

TLD

TLD is short for Top Level Domain which is the last part in every domain name e.g .com, .gov, .org. Some domains have a second level domain name as well e.g .co.uk, .com.au. TLDs are controlled by the Internet Assigned Numbers Authority or IANA in a root zone database which is essentially a database of all available top level domains. This database is public and you can see it here

Domain Registrars

A Registrar is an authority that assigns domain names under top level domains. Because all domain names have to be unique there has to be a way to organize domain names so they’re not duplicated. That’s why domains are registered with InterNIC, a service of ICANN which enforces the uniqueness of domain names across the internet. All domains are registered in a central database known as WhoIS database.

SOA record

SOA is short for Start of Authority. Every domain must have an SOA record. It is a way for the domain admins to provide information about the domain. A Zone file - which is a text file that describes a DNS Zone - can contain only one SOA Record.

Property Description
Name Name of the zone
IN Zone class ( usually IN for internet)
SOA Start of Authority
NName Primary master name server for the zone
RName Email of the admin responsible for the zone
Serial Serial number for the zone
Refresh Number of seconds after which secondary name servers \r should query the master for the SOA record, to detect \r zone changes
Retry Number of seconds after which secondary NS should retry \r request serial number if unresponsive master
Expire Number of seconds after which secondary NS should stop \r answering the request for zone if unresponsive master
TTL Time To Live for purposes of negative caching

Example SOA would look like this

[NName][RName][Serial][Refresh][Retry][Expire][TTL]
ns214.awsdns-53.com awsdns-exanubes.amazon.com 2021031501 86400 7200 604800 300

NS Record

NS is short for Name Server. It is used by TLD servers to direct traffic to the Content DNS server which contains the authoritative DNS records. In short when the user makes a request, he first makes a DNS request which then makes a NS Record lookup which then leads us to the SOA Record.

A Record

A is short for Address. It is a fundamental type of DNS Record which is responsible for translating the domain name/URL into IPv4.

AAAA Record

In internet security AAAA stands for authentication, authorization, accounting and auditing but I couldn’t find any verification that this is the case with AAAA Record. AAAA is responsible for translating the domain name/URL into IPv6 and it is optional.

TTL

TTL is short for Time To Live. This defines the length of time - in seconds - that a DNS record should be cached for. The lower the time to live, the faster the changes to DNS records propagate throughout the internet. If for example TTL was set to 8 hours it would mean that if someone had just visited a website which was subsequently cached, it would take up to 8 hours for the DNS changes to show up for that user.

CName

CNAME is short for Canonical Name. It is used for mapping one URL to another. For example, let’s say there’s a dedicated subdomain for blog content at blog.exanubes.com we could use a CNAME Record to allow traffic through b.exanubes.com as well.

Alias

Alias Records allow mapping a URL to any AWS Resource. Commonly used to map resource record sets in a hosted zone to Elastic Load Balancers, CloudFront distributions or S3 buckets that are configured as websites. It works like a CNAME record in that it can be used to map one DNS name to another. However, the key difference is that CNAME can’t be used for naked domain names aka zone apex. This means you can’t have a CNAME for http://exanubes.com, it has to be either an A Record or an Alias.

Summary

To sum up. Route 53 helps us manage our DNS records including but not limited to translating the domain name into application server’s IP address, adding aliases, health checks and load balancers. Diagram of navigating to a website When user makes a request, it first goes to a DNS resolver which does a cache look up. If it can’t find the IP address in its cache, the request is forwarded to the root zone server. The root zone server does not hold the individual IP addresses but can point the resolver to the appropriate TLD name server which in turn can point us to the name server that has our DNS Records - in this case it’s Route 53. Then, using the A Record, the domain name is translated into an IPv4 address and sent back to the resolver and then the browser. Last step is for the browser to make a request to the IP address pointing to a host that is being requested and receive the application files.