Stop 08 · DNS, CDN & Edge ServicesTopics · 2/7

Amazon Route 53 Hosted Zones & Records

Part of the AWS Roadmap

In short

Your app can be perfect, but if typing your domain doesn't lead anywhere, nobody will ever see it. Route 53 is where you tell the internet which address your name points to.

Route 53 is AWS's DNS service. A hosted zone holds the records for a domain, and alias records can point a domain, including the root domain, straight at AWS resources such as CloudFront, load balancers and S3 website endpoints.

The jaadu, dressed as a society security guard, runs a finger down a big directory board at the gate and points a visitor towards the right tower.

Think of it like this

The society's intercom directory

Every housing society in Bengaluru has a directory at the gate: flat owner's name on the left, flat number and intercom extension on the right. The guard looks up a name and connects you. A hosted zone is that directory for one domain, and each record is one line in it: this name goes to this address.

Watch it happen

Resolving www.priyabakes.in

Browser
Resolver
Root and .in
Route 53 zone

www.priyabakes.in?

1/6The browser asks its DNS resolver, usually run by the ISP or a public DNS service.

The big ideas

What you need to know

Hosted zone = one domain

A public hosted zone answers internet queries for a domain. A private hosted zone answers only inside the VPCs you link to it.

Common record types

A maps to IPv4, AAAA to IPv6, CNAME to another name, MX to mail servers and TXT holds text such as verification codes.

Alias records

An AWS extension that points to CloudFront, load balancers, S3 website endpoints and more. It works at the root domain, where a CNAME is not allowed.

TTL controls caching

Resolvers keep an answer for the TTL in seconds. Lower it a day before a migration so changes spread quickly.

How it works

Putting a new domain on Route 53

  1. 1

    Create the hosted zone

    Route 53 gives you four name servers and creates NS and SOA records.

  2. 2

    Update the registrar

    At GoDaddy, Hostinger or wherever you bought the domain, replace the name servers with the four from Route 53.

  3. 3

    Add records

    Create A or alias records for the root and www, and MX or TXT records for email.

  4. 4

    Verify

    Use dig or nslookup to confirm the answers once the change has spread.

See it in code

Walk through the code

bash
1# 1. Create a public hosted zone2aws route53 create-hosted-zone \3  --name priyabakes.in \4  --caller-reference "zone-$(date +%s)"5 6# 2. Point the root domain at a CloudFront distribution7cat > change.json <<'EOF'8{9  "Changes": [{10    "Action": "UPSERT",11    "ResourceRecordSet": {12      "Name": "priyabakes.in",13      "Type": "A",14      "AliasTarget": {15        "HostedZoneId": "Z2FDTNDATAQYW2",16        "DNSName": "d111111abcdef8.cloudfront.net",17        "EvaluateTargetHealth": false18      }19    }20  }]21}22EOF23aws route53 change-resource-record-sets \24  --hosted-zone-id Z0123456789ABCDEFGHIJ \25  --change-batch file://change.json26 27# 3. Check the answer28dig +short priyabakes.in

1/4The caller reference just has to be unique, so a timestamp works. The output lists your four name servers.

AWS CLI v2. Z2FDTNDATAQYW2 is the fixed hosted zone ID that every CloudFront alias uses. Your own zone ID comes from step 1.

Save yourself the pain

Common mistakes

Oops

Creating a hosted zone but never updating the name servers at the registrar.

Do this instead

The registrar decides which name servers are authoritative. Copy the four NS values from Route 53 into the registrar's settings.

Oops

Trying to put a CNAME on the root domain (priyabakes.in).

Do this instead

DNS forbids a CNAME at the zone apex. Use a Route 53 alias A record pointing at the AWS resource instead.

Oops

Keeping a TTL of 86400 right before switching servers.

Do this instead

Drop the TTL to 60 or 300 seconds a day ahead, make the switch, then raise it again.

Your mission

Map out a domain

~20 min

Quick check

Why use an alias record instead of a CNAME for priyabakes.in pointing at CloudFront?

Go deeper

  1. 1Create a public hosted zone for a domain you own, or read the steps if you do not have one.
  2. 2Add an A record and an alias record and compare how they resolve with dig.
  3. 3Learn why you update the name servers at your domain registrar.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge