Skip to main content

DNS Concepts and Route 53

What is DNS?​

The DNS (Domain Name System) is the system that translates domain names (e.g., www.example.com) into IP addresses (e.g., 192.0.2.1).

┌─────────────────────────────────────────────────────────────┐
│ DNS - THE CONCEPT │
├─────────────────────────────────────────────────────────────┤
│ │
│ Without DNS: │
│ ─────────── │
│ http://192.0.2.44 ← Hard to remember! │
│ http://52.84.133.67 ← Can change! │
│ │
│ With DNS: │
│ ──────── │
│ http://www.my-site.com ← Easy to remember! │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ User DNS Server Web Server │ │
│ │ │ │ │ │ │
│ │ │ "www.my-site.com?" │ │ │ │
│ │ ├────────────────────►│ │ │ │
│ │ │ │ │ │ │
│ │ │ "192.0.2.44" │ │ │ │
│ │ │◄────────────────────┤ │ │ │
│ │ │ │ │ │ │
│ │ │ Connect to 192.0.2.44 │ │ │
│ │ ├────────────────────────────────────►│ │ │
│ │ │ │ │ │ │
│ │ │ Web page │ │ │
│ │ │◄────────────────────────────────────┤ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘

DNS Hierarchy​

┌─────────────────────────────────────────────────────────────┐
│ DNS HIERARCHY │
├─────────────────────────────────────────────────────────────┤
│ │
│ . (root) │
│ │ │
│ ┌──────────────┼──────────────┐ │
│ │ │ │ │
│ .com .org .ca │
│ │ │ │ │
│ ┌────┴────┐ │ │ │
│ │ │ │ │ │
│ amazon google wikipedia gc │
│ │ │ │ │ │
│ ┌──┴──┐ ┌──┴──┐ │ │ │
│ www s3 www mail www www │
│ │
│ Full example: │
│ www.amazon.com. │
│ ─── ────── ─── ─ │
│ │ │ │ └── Root (implicit) │
│ │ │ └────── TLD (Top Level Domain) │
│ │ └─────────── SLD (Second Level Domain) │
│ └──────────────── Subdomain │
│ │
└─────────────────────────────────────────────────────────────┘

Types of DNS Records​

The Most Important​

┌─────────────────────────────────────────────────────────────┐
│ TYPES OF RECORDS │
├─────────────────────────────────────────────────────────────┤
│ │
│ TYPE A (Address) │
│ ──────────────── │
│ Associates a name with an IPv4 address │
│ www.example.com → 192.0.2.44 │
│ │
│ TYPE AAAA │
│ ───────── │
│ Associates a name with an IPv6 address │
│ www.example.com → 2001:0db8:85a3::8a2e:0370:7334 │
│ │
│ TYPE CNAME (Canonical Name) │
│ ─────────────────────────── │
│ Creates an alias to another name │
│ blog.example.com → www.example.com │
│ ⚠️ Cannot be at the root (example.com) │
│ │
│ TYPE ALIAS (AWS specific) │
│ ─────────────────────────── │
│ Like CNAME but works at the root │
│ example.com → d1234.cloudfront.net │
│ ✅ Can be at the root! │
│ │
│ TYPE MX (Mail Exchange) │
│ ─────────────────────── │
│ Mail servers for the domain │
│ example.com → mail1.example.com (priority 10) │
│ │
│ TYPE TXT │
│ ──────── │
│ Arbitrary text (verification, SPF, DKIM) │
│ example.com → "v=spf1 include:_spf.google.com ~all" │
│ │
│ TYPE NS (Name Server) │
│ ───────────────────── │
│ Authoritative DNS servers for the zone │
│ example.com → ns1.route53.aws.com │
│ │
└─────────────────────────────────────────────────────────────┘

Summary Table​

TypeUsageExample
AName → IPv4www → 192.0.2.44
AAAAName → IPv6www → 2001:db8::1
CNAMEAlias (not root)blog → www
ALIASAlias (root OK)@ → ALB
MXMail servers@ → mail.example.com
TXTText, verificationSPF, DKIM
NSDNS servers@ → ns1.aws.com

TTL (Time To Live)​

┌─────────────────────────────────────────────────────────────┐
│ TTL - TIME TO LIVE │
├─────────────────────────────────────────────────────────────┤
│ │
│ TTL indicates how long a record can be cached (in seconds) │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ DNS Request Local Cache Route 53 │ │
│ │ │ │ │ │ │
│ │ │ Request │ │ │ │
│ │ ├─────────────►│ │ │ │
│ │ │ │ │ │ │
│ │ │ "Not cached, asking Route 53" │ │
│ │ │ ├──────────────►│ │ │
│ │ │ │ │ │ │
│ │ │ │ 192.0.2.44 │ │ │
│ │ │ │ TTL: 300 │ │ │
│ │ │ │◄──────────────┤ │ │
│ │ │ │ │ │ │
│ │ │ Stores 5 min │ │ │ │
│ │ │ │ │ │ │
│ │ │ 192.0.2.44 │ │ │ │
│ │ │◄─────────────┤ │ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ Short TTLs (60-300s) Long TTLs (3600-86400s) │
│ ──────────────────── ───────────────────────── │
│ ✅ Fast changes ✅ Fewer DNS requests │
│ ❌ More DNS requests ❌ Slow propagation │
│ Case: Migration, failover Case: Stable sites │
│ │
└─────────────────────────────────────────────────────────────┘

Route 53 - AWS DNS Service​

Features​

┌─────────────────────────────────────────────────────────────┐
│ ROUTE 53 - FEATURES │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. AUTHORITATIVE DNS │
│ ───────────────── │
│ Hosts the DNS zones of your domains │
│ 100% SLA availability │
│ │
│ 2. DOMAIN REGISTRATION │
│ ─────────────────────────── │
│ Buy domains (.com, .net, .io...) │
│ Automatic renewal │
│ │
│ 3. HEALTH CHECKS │
│ ───────────── │
│ Endpoint monitoring │
│ Automatically removes down targets │
│ │
│ 4. ROUTING POLICIES │
│ ───────────────────── │
│ Simple, Weighted, Latency, Failover, Geolocation... │
│ │
│ 5. ALIAS RECORDS │
│ ───────────── │
│ Point to AWS resources without IP │
│ (ALB, CloudFront, S3, API Gateway...) │
│ │
└─────────────────────────────────────────────────────────────┘

Hosted Zones​

┌─────────────────────────────────────────────────────────────┐
│ HOSTED ZONES │
├─────────────────────────────────────────────────────────────┤
│ │
│ A Hosted Zone = Container for the records of a domain │
│ │
│ PUBLIC HOSTED ZONE │
│ ────────────────── │
│ • Accessible from the Internet │
│ • For public websites │
│ • Cost: $0.50/month per zone │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Hosted Zone: example.com │ │
│ │ │ │
│ │ NS example.com ns-123.awsdns-45.com │ │
│ │ SOA example.com ns-123.awsdns-45.com admin │ │
│ │ A example.com 52.84.133.67 │ │
│ │ A www 52.84.133.67 │ │
│ │ CNAME blog www.example.com │ │
│ │ MX example.com 10 mail.example.com │ │
│ │ │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ PRIVATE HOSTED ZONE │
│ ─────────────────── │
│ • Accessible only from VPC │
│ • For internal resources │
│ • Private DNS (db.internal, api.internal) │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Hosted Zone: internal.company │ │
│ │ Associated VPCs: vpc-prod, vpc-dev │ │
│ │ │ │
│ │ A db.internal.company 10.0.1.50 │ │
│ │ A api.internal.company 10.0.2.30 │ │
│ │ A cache.internal.company 10.0.3.20 │ │
│ │ │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘

CLI Configuration​

# Create a public Hosted Zone
aws route53 create-hosted-zone \
--name example.com \
--caller-reference unique-string-1234

# Create a private Hosted Zone
aws route53 create-hosted-zone \
--name internal.company \
--caller-reference unique-string-5678 \
--vpc VPCRegion=us-east-1,VPCId=vpc-xxx \
--hosted-zone-config PrivateZone=true

# Create an A record
aws route53 change-resource-record-sets \
--hosted-zone-id Z1234567890ABC \
--change-batch '{
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "www.example.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [{"Value": "192.0.2.44"}]
}
}]
}'

# Create an ALIAS to an ALB
aws route53 change-resource-record-sets \
--hosted-zone-id Z1234567890ABC \
--change-batch '{
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "example.com",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z35SXDOTRQ7X7K",
"DNSName": "my-alb-1234.us-east-1.elb.amazonaws.com",
"EvaluateTargetHealth": true
}
}
}]
}'

Summary​

ConceptDescription
DNSTranslates names to IPs
A RecordName → IPv4
CNAMEAlias (not root)
ALIASAWS Alias (root OK)
TTLCache duration
Hosted ZoneContainer of records

Next section: Routing Policies