Understanding DNS and Amazon's Route 53 Cloud Service: A Beginner's Introduction
Published: 2023-04-26 22:17:40

Have you ever wondered what happens in the background right after you type and search for a website name in the web browser? How does your computer know where to find a website?  This answer, you will find in the Domain Name System(DNS), mostly referred to as the **internet’s address book**. So what's the connection between DNS and ROUTE53? well, Route53 is a highly available and scalable cloud-based DNS service provided by Amazon Web Service(AWS). But, before I go deeper into Amazon Route 53, I will guide you through the fundamentals of DNS to help you better understand how and why to use Route 53. Now get ready to learn more about the **internet’s address book.**

![Image by Intellipaat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6o08rfjmq7f2p14q0kk6.png)

       SO WHAT IS DNS AND HOW DOES IT WORK?
DNS is a system that helps translate human-readable domain names, for example, www.moses.com to their respective machine-readable IP Address(Internet-Protocol Address), for example, 192.168.1.2.

_An IP address is a unique numerical identifier for every device, website, or network that connects to the Internet. Typically assigned by an internet service provider (ISP), an IP address is an online device address used for communicating across the internet._
IP Address is solely responsible for locating websites and other services on the internet because, Unlike humans that identify by names, computers identify by numbers and that is how communications happen over the internet, But as you know it’s almost impossible for us as humans to remember the IP addresses of every website we need to visit on a daily basis, which begs the question, how do we bridge the communication gap?, then DNS came to our rescue, acts as a bridge by translating **human-readable domain names** that we can easily remember into **machine-readable IP addresses,** great right?.

**Types of DNS servers that make sure your requests are served and they are as follows;**

1.**Recursive DNS Resolver:** Are responsible for directly processing requests from end-users or clients, and providing DNS resolution for end users. When a user types in a domain name, the recursive DNS server will query the other DNS servers on behalf of the end-users until it finds the IP address associated with the domain name. 
2.**Caching DNS Servers:** These are DNS servers that store DNS records for a period of time after they have been retrieved. When a recursive DNS server queries a caching DNS server, it can retrieve the DNS records more quickly because they are already stored in the cache.
3.**Root DNS Servers:** This type of server is responsible for directing requests to the appropriate Top-Level Domain (TLD) DNS server. It maintains a list of all TLDs and their corresponding DNS servers. 
4.**Top-Level Domain (TLD) DNS Servers:** This type of server is responsible for resolving domain names for a particular top-level domain (TLD), such as .com, .org, etc. It maintains a list of authoritative DNS servers for each domain registered under that TLD.
5.**Authoritative DNS Servers:** This type of server is responsible for maintaining the actual DNS records for a particular domain name. When a recursive DNS server queries an authoritative DNS server, it receives the final IP address for the domain name.

**How DNS Works? let's get to it**

When you type a domain name into your web browser, your computer contacts a **Recursive DNS Resolver** to obtain the corresponding IP address for that domain. The DNS server checks the Cache of frequently-used IP Addresses, but if it doesn't have the information, it then will query other DNS servers recursively in a hierarchical order from **Root DNS Servers** to **Top-Level Domain (TLD)** DNS Servers and finally **Authoritative DNS Servers** until it finds the correct IP address. Once your computer has the IP address, it can connect to the server hosting the website or service you requested.
![DNS LOOKUP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h363jq2b07qxb2qp5iqd.png)

        WHAT IS AMAZON ROUTE53?
Amazon Route 53 is a highly scalable and reliable DNS web service provided by (AWS). It allows you to route traffic to resources such as EC2 instances, S3 buckets, and Elastic Load Balancers.

_With Amazon Route53 you get domain management service features that go beyond domain registration and name resolution, you are allowed to control how traffic is directed globally._

**Benefits Of Route53?**
* **Highly Available:** Consistently ensure traffic is routed to the end user, and DNS servers can be distributed across many availability zones.
* **Flexible:** Route 53 Traffic Flow provides users with flexibility in choosing traffic policies based on multiple criteria, such as endpoint health, geographic location, and latency.
* **Fast:** Route 53 DNS servers are distributed around the globe to provide a low-latency fast service.  
* **Scalable:** Route 53 can automatically scale out and handle a large volume of queries, making it ideal for applications with varying traffic patterns.
* **Easy to use:** It’s easy to use, sign up, configure, and provides fast responses.
* **Cost Effective:** Route 53 offers a pay-as-you-go pricing model, With route53 you only have to pay for the services you use.
* **Secure:** It’s very secure, because of the easy integration with Identity and Access Management (IAM).

**Functions Of Route53**

* **DNS management:** Route 53 allows users to manage DNS settings for their domains, including creating and editing DNS records such as A, and CNAME records.
* **Traffic Management:** Route 53 can manage the flow of traffic to different resources in a way that optimizes performance and minimizes latency.
* **Monitoring:** Route 53 can monitor the health of your resources, discover unhealthy resources, and send traffic accordingly through to healthy resources only.
* **Domain Registration:** This allows you to purchase a custom domain name in AWS.
* **DNS query logging:** Route 53 is able to log DNS queries for your domains and provide you with insights into users' interaction with your website.
* **DNS failover:** Route 53 can automatically redirect traffic to healthy resources only in the event of a failure.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nn26x9sr8qfdng2se3me.png)

**What is Route 53 hosted zone?**

A hosted zone is a like a container in route53, that contains and manages DNS records of a domain name.
Hosted zone in route53 can be compared to the DNS zone file in traditional DNS.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/naaoes9rju4rh0g4fth8.png)

**DNS Records**

_Several types of DNS  records are used to map domain names to their corresponding IP addresses or perform other functions. Here are some of the most common types of DNS records:_
* **A Record (Address Record):** This maps a domain name to an IPv4 address.
* **AAAA Record (IPv6 Address Record):** This maps a domain name to an IPv6 address.
* **CNAME Record (Canonical Name Record):** This maps a domain name to another domain name, which is usually the canonical (official) name of a website.
* **NS Record (Name Server Record):** This identifies the authoritative name servers for a domain.
* **SOA Record (Start of Authority Record):** Contains information about a DNS zone, including the primary name server for the zone, the email address of the administrator responsible for the zone, and other settings.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y7n05be61u5lf1uspbf0.png)


**Routing Policies**

* **Simple Routing:** This Is the most basic routing policy defined using an A or AAAA record to resolve to a single resource with a specific function for your domain, for example, a cloud front distribution serving a static website.
**_Note that_** Simple routing policy does not support health checks.
![SIMPLE ROUTING POLICY](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jkuv0lo3zlg3syua6m9.png)

* **Failover Routing:** This is used to configure active/passive setup, such that traffic is routed to one resource(a primary record) while it’s healthy but when unhealthy it automatically directs traffic to the other healthy resource(a secondary record).
![FAILOVER ROUTING POLICY](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qg0uzsn22urb9j57zrlo.png)

* **Geolocation Routing:** This is used to route traffic based on the geographical location of the user or client, this traffic is routed to resources in the same region where the user’s DNS queries originated from.
![GEOLOCATION ROUTING POLICY](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5lwdze6788btps51bngk.png)

* **Latency Routing:** Is used to route traffic to resources with the lowest latency to the customer/client, if you have your resources in multiple regions,  you want to route the client's traffic to the region that provides them the fattest delivery.
![LATENCY ROUTING POLICY](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pam56d6csjxd95xhq9h.png)

* **Weighted Routing:** A weighted routing policy allows you to distribute traffic across resources, however, this has nothing to do with latency or geographic location. Because you can choose how much traffic should be sent to each resource by allocating weight percentage, and you have full control over the flow of traffic.
![WEIGHTED ROUTING POLICY](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hcrlixjwu6haoe2ehre.png)

To learn even more about Route53, check out this documentation by AWS:
https://aws.amazon.com/route53/

https://aws.amazon.com/route53/what-is-dns/

AWS HOW-TO GUIDE to Register a Domain Name with Amazon Route 53
https://aws.amazon.com/getting-started/hands-on/get-a-domain/

**Conclusion**
For anyone looking to manage their website's Domain Name and associated IP addresses, Amazon Route53 is a go-to tool that helps simplify the management of DNS and improve the overall performance and reliability of your websites.
So with this beginner's introduction, you now have a better understanding of how DNS and Route53 work, with further practice and experimentation you should be ready to take full advantage of Route53 and all the special features it has to offer.