Skip to content
5 min read·Lesson 3 of 10

DNS: The Internet's Phone Book

Understand how DNS resolves domain names to IP addresses, the DNS record types you need to know, and how Route 53 works for cloud workloads.

DNS (Domain Name System) is one of the most critical pieces of internet infrastructure. Without it, you'd need to remember IP addresses for every website. Understanding DNS helps you troubleshoot resolution failures, configure cloud services, and design resilient routing.

How DNS Resolution Works

When your browser needs to resolve app.example.com:

  1. Browser cache: Checks its own DNS cache first
  2. OS cache: Checks the system resolver cache
  3. Recursive resolver: Your ISP's or configured DNS server (e.g., 8.8.8.8) takes over
  4. Root nameservers: The resolver asks a root server "who handles .com?" → returns TLD nameserver IPs
  5. TLD nameserver: "Who handles example.com?" → returns authoritative nameserver IPs
  6. Authoritative nameserver: "What is app.example.com?" → returns the A record (IP address)
  7. The resolver caches the result according to the TTL and returns it to the client

DNS Record Types

RecordPurposeExample
AIPv4 addressexample.com → 93.184.216.34
AAAAIPv6 addressexample.com → 2606:2800:220:1:248:1893:25c8:1946
CNAMEAlias to another namewww.example.com → example.com
MXMail exchangeexample.com → mail.example.com (priority 10)
TXTText dataSPF, DKIM, domain verification
NSNameserver for a zoneexample.com → ns1.registrar.com
SOAStart of authority (zone info)Serial, refresh interval, etc.
PTRReverse lookup (IP → name)34.216.184.93.in-addr.arpa → example.com
SRVService locationUsed by Kubernetes, SIP, XMPP
CAACA Authorisation (TLS certs)Which CAs may issue certs for this domain
ALIAS / ANAMEA record at zone apex (Route 53)example.com → ALB DNS name

TTL (Time To Live)

TTL is the number of seconds a DNS record may be cached by resolvers and clients. Lower TTL means changes propagate faster but generates more DNS queries:

  • 300 seconds (5 min): Before planned changes (failover, migration)
  • 3600 seconds (1 hr): Standard for stable records
  • 86400 seconds (24 hr): Rarely changing records (SPF, TXT verification)

CNAME Restrictions

A CNAME cannot be used at the zone apex (bare domain). You cannot have:

example.com CNAME myalb-1234.us-east-1.elb.amazonaws.com  # INVALID

Solutions:

  • Use an ALIAS record in Route 53 (maps zone apex to AWS resources — ALB, CloudFront, etc.)
  • Use a subdomain: www.example.com CNAME ... is valid

Route 53 Routing Policies

Amazon Route 53 offers several routing policies for intelligent traffic distribution:

PolicyBehaviourUse Case
SimpleReturns one or all recordsSingle resource
WeightedDistributes traffic by weight (0–255)Canary deployments, A/B testing
LatencyRoutes to lowest-latency regionGlobal multi-region apps
FailoverPrimary → standby on health check failureActive-passive DR
GeolocationRoutes based on user's country/continentLocalisation, GDPR data residency
GeoproximityRoutes based on distance, with biasAdvanced geographic control
MultivalueReturns multiple IPs with health checkingSimple load distribution
IP-basedRoutes based on client IP CIDRRoute by ISP or corporate network

DNS Troubleshooting

# Look up A record
dig app.example.com
nslookup app.example.com

# Look up specific record type
dig example.com MX
dig example.com TXT
dig example.com NS

# Check which nameserver is authoritative
dig example.com NS +short

# Trace the full resolution chain
dig app.example.com +trace

# Reverse lookup
dig -x 93.184.216.34

# Query a specific DNS server
dig @8.8.8.8 example.com

Next: HTTP and TLS — how web requests work, the security layer on top, and what certificates are doing.

Key Takeaways

  • DNS translates human-readable domain names into IP addresses.
  • The resolution chain: recursive resolver → root → TLD → authoritative nameserver.
  • A records map names to IPv4; AAAA to IPv6; CNAME creates aliases; MX for email; TXT for verification.
  • TTL (Time To Live) controls how long DNS responses are cached.
  • Route 53 supports routing policies: simple, weighted, latency, failover, geolocation.

Test your knowledge

Try exam-style practice questions to reinforce what you've learned.

Practice Questions →