What is DNS?
Domain Name System which translates the human friendly hostnames into the machine IP addresses
www.google.com => 172.217.18.36
DNS is the backbone of the internet
DNS uses hierarchical naming structure: .com, .example.com, www.example.com, api.example.com
DNS Terminologies
Domain Registrar: Amazon Route 53, GoDaddy, Hostinger, ...
DNS Records: A, AAAA, CNAME, NS, ...
Zone File: contains DNS records
Name Server: resolves DNS queries (Authoritative or Non-Authoritative)
Top Level Domain (TLD): .com, .us, .in, .gov, ...
Second Level Domain (SLD): amazon.com, google.com, ...
Sub Domain: www.example.com, ...
Full Qualified Domain Name (FQDN): api.www.example.com
Amazon Route 53 Overview
-
A highly available, scalable, fully managed and Authoritative DNS
- Authoritative = the customer (you) can update the DNS records
Route 53 is also a Domain Registrar
Ability to check the health of your resources
Why 53? 53 is a reference to the traditional DNS port
Route 53 - Records
Records describes how you want to route traffic for a domain
-
Each record contains:
- Domain/subdomain Name - e.g., example.com
- Record Type - e.g, A or AAAA,...
- Value - e.g, 12.34.56.78
- Routing Policy - how Route 53 responses to queries
- TTL - amount of time the record cached at DNS Resolvers
-
Route 53 supports the following DNS record type
- (must know) A / AAAA / CNAME / NS
- (advanced) CAA / DS / MX / NAPTR / PRT / SOA / TXT / SPF / SRV
Record Types
A - maps a hostname to IPv4
AAAA - maps a hostname to IPv6
-
CNAME - maps a hostname to another hostname
- The target is a domain name which must have an A or AAAA record
- Can't create a CNAME record for the top node of a DNS namespace (Zone Apex)
- Example: you can't create for the example.com, but you can create for www.example.com
-
NS - Name Servers for the Hosted Zone
- Control how traffic is routed for a domain
Hosted Zones
A container for records that define how to route traffic to a domain and its subdomains
Public Hosted Zones - contains records that specify how you route traffic on the Internet (public domain names)
Private Hosted Zones - contains records that specify how you route traffic within one or more VPCs (private domain names)
CNAME vs Alias
AWS Resources (Load Balancer, CloudFront,...) expose an AWS hostname.
ex. lb1-1234.us-east-2.alb.amazonaws.com and you want myapp.mydomain.com-
CNAME:
- Points a hostname to any other hostname . (app.mydomain.com => blabla.anything.com)
- ONLY FOR NON ROOT DOMAIN
-
Alias:
- Points a hostname to an AWS Resoure (app.mydomain.com => blabla.amazonaws.com)
- Works for ROOT DOMAIN and NON ROOT DOMAIN
- Free of charge
- Native health check
- Alias Record is always of type A/AAAA for AWS resources (IPv4/IPv6)
- You can't set TTL
Alias Records Targets
Elastic Load Balancers
CloudFront Distribution
API Gateway
Elastic Beanstalk environments
S3 Websites
VPC Interface Endpoints
Global Accelerator accelerator
Route 53 Record in the same hosted zone
You cannot set an ALIAS record for an EC2 DNS name
Top comments (0)