Skip to main content
PreparationZone Logo
PrepZone

DNS Fundamentals

How a domain name becomes an IP address and why DNS matters at every layer of scale.

Pass checkpoint below

How DNS resolution works

When a browser requests api.streamhub.com, it does not know the server's IP. A multi-step lookup resolves the name.

DNS lookup path (Route 53)

querydelegationaliasCLIENT
Browser / appapi.streamhub.com
NETWORK
Route 53 Resolv…recursive lookup
NETWORK
Hosted ZoneA/AAAA alias
NETWORK
ALB / CloudFronttarget IP
Every request starts here — api.streamhub.com resolves to ALB or CloudFront.

StreamHub production architecture (AWS)

HTTPSstaticmissAPICLIENT
Mobile / WebStreamHub cli…
NETWORK
Route 53GeoDNS routing
NETWORK
CloudFrontCDN + WAF edge
NETWORK
AWS ALBTLS terminati…
NETWORK
API GatewayJWT · rate li…
STORAGE
Amazon S3media origin
COMPUTE
Amazon EKSAPI · auth · …
DATABASE
ElastiCachesessions · ho…
DATABASE
RDS Postgresprimary + rep…
INTEGRATION
Amazon MSKdomain events
ANALYTICS
OpenSearchstream discov…
OPS
CloudWatchmetrics · X-R…
End-to-end path from user to data — reference this when placing any new service.

Resolution chain

  1. Browser cache — recent lookups cached for TTL seconds.
  2. OS resolver cache — local stub resolver.
  3. Recursive resolver — ISP DNS or public resolver (8.8.8.8, 1.1.1.1).
  4. Root → TLD → authoritative — delegation until the domain's nameserver answers.
  5. A/AAAA record — IPv4 or IPv6 address returned to the client.
Java
# Trace a lookup (simplified)
dig +trace api.streamhub.com A

# Check TTL — how long clients cache this answer
dig api.streamhub.com | grep -E 'ANSWER|IN A'

DNS record types you need

RecordPurposeExample
A / AAAAHostname → IPapi.streamhub.com → 52.12.34.56
CNAMEAlias to another namewww → streamhub.com
MXMail servermail.streamhub.com
TXTVerification, SPF, DKIMv=spf1 include:...
NSAuthoritative nameserverns1.cloudprovider.com
SRVService location_https._tcp service discovery
  • A / AAAA

    PurposeHostname → IP
    Exampleapi.streamhub.com → 52.12.34.56
  • CNAME

    PurposeAlias to another name
    Examplewww → streamhub.com
  • MX

    PurposeMail server
    Examplemail.streamhub.com
  • TXT

    PurposeVerification, SPF, DKIM
    Examplev=spf1 include:...
  • NS

    PurposeAuthoritative nameserver
    Examplens1.cloudprovider.com
  • SRV

    PurposeService location
    Example_https._tcp service discovery

For system design interviews, A/AAAA, CNAME, and TTL matter most.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 4 sections

  • TTL and caching trade-offs
  • DNS in scaled architectures
  • DNS as a failure point
  • Internal vs external DNS

Test yourself

Answer these before moving on — recall is what makes it stick.