Route 53 DNS

People joke that “it’s always DNS”, and the joke works because it so often is. Apps break when a name still points at an old IP, when someone forgot to create a record, or when a private name gets used from outside the network. Route 53 DNS is where AWS teams look after these names, both for public websites and for private names inside a VPC.

You’ll create a private hosted zone called saat.internal for saat-vpc, add A, CNAME and TXT records, query them from a server with dig, and find out why your laptop can’t see any of them. You won’t need to buy a domain.

TimeYou needBy the end you can
60 minutes (one small instance and the Session Manager endpoints for under an hour)saat-vpc, Start-SsmEndpoints.ps1 and Stop-SsmEndpoints.ps1, saat-ec2-ssm-profile (Lessons 8 to 14), your laptop signed in as saat-admin. Cost: about USD 0.10; a hosted zone deleted within 12 hours of creation is not charged.Create a private hosted zone, change records safely with CREATE, UPSERT and DELETE, read dig output and TTLs, and choose a routing policy.

What it is, in one line

Route 53 DNS is the AWS service that answers “what’s the address for this name?”, both for public domains on the internet and for private names inside your VPCs.

In Simple Words

The phone book at the reception desk

People remember names, not phone numbers, so DNS is the phone book that turns “app” into the number 10.20.11.25. A public hosted zone is the city phone book that anyone can read, and a private hosted zone is the office’s internal list kept at reception, which only people inside the building can ask for. Once someone looks up a number they remember it for a while instead of asking every time, and that “while” is the TTL. If the number changes, anyone who asked recently keeps ringing the old one until their memory runs out.

Engineer's View

What Route 53 really does

A hosted zone holds the records for one domain. Public zones are answered by Route 53’s name servers out on the internet, while private zones are answered only by the Route 53 Resolver inside the VPCs you’ve associated with them. The VPC needs enableDnsSupport and enableDnsHostnames switched on, and saat-vpc has had both since Lesson 8.

Inside a VPC, instances send their queries to the resolver at the VPC base address plus two (10.20.0.2 here) or to 169.254.169.253. The record types you’ll see most are A (IPv4 address), AAAA (IPv6), CNAME (an alias to another name, never allowed at the zone apex), TXT (text, often for ownership checks), MX (mail), and Route 53 alias records, which point at AWS resources like load balancers and do work at the apex.

You make changes through change-resource-record-sets with CREATE, UPSERT or DELETE, and they usually become INSYNC on all Route 53 servers within a minute, though clients can keep using a cached answer until its TTL runs out. ICANN has reserved .internal for private use, so it’ll never clash with a real public domain.

How it works, step by step

This is the path a single query takes inside saat-vpc.

1The instance asks the VPC resolver

dig app.saat.internal sends a UDP query on port 53 to 10.20.0.2. You don’t have to configure that anywhere, because the VPC’s DHCP options hand it out.

Route 53 DNS resolution flow inside a VPC with a private hosted zone

2The resolver checks private zones first

saat.internal is associated with saat-vpc, so the resolver answers from your private zone, and anything it doesn’t own, such as amazon.com, gets resolved on the public internet.

3The answer comes back with a TTL

The client caches 10.20.11.25 for 60 seconds. With a short TTL your changes take effect quickly, and with a long one there are fewer queries and less exposure when DNS has problems.

4Routing policies choose between answers

When a name has more than one possible answer, the routing policy decides which one Route 53 hands out:

Route 53 routing policies compared: simple, weighted, failover, latency

Teams use weighted and failover records to shift traffic during releases and disasters without touching the apps at all. Lesson 20 adds alias records for load balancers.

✅ Checkpoint: You can explain a private hosted zone, where an instance sends its DNS queries, what a TTL does, and why a CNAME can’t go at the zone apex.

Hands-on lab: private Route 53 DNS for saat-vpc

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

Start the way you usually do, with the Session Manager endpoints:

cd C:\aws-lab
aws login --profile saat-admin
$env:AWS_PROFILE = 'saat-admin'
$env:Path += ';C:\Program Files\Amazon\SessionManagerPlugin\bin'
$v = Get-Content C:\aws-lab\saat-vpc.json | ConvertFrom-Json
.\Start-SsmEndpoints.ps1

1Launch dns01 with dig installed

Paste this whole block:

[IO.File]::WriteAllText('C:\aws-lab\dns-userdata.sh', "#!/bin/bash`ndnf install -y bind-utils`n")
$base = aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 --query Parameter.Value --output text
$i = aws ec2 run-instances --image-id $base --instance-type t3.micro --subnet-id $v.PrivateA --security-group-ids $v.AppSg --iam-instance-profile Name=saat-ec2-ssm-profile --metadata-options HttpTokens=required --user-data file://dns-userdata.sh --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=dns01},{Key=course,Value=saatvedha-aws},{Key=lesson,Value=19}]' --query "Instances[0].InstanceId" --output text
$ip = aws ec2 describe-instances --instance-ids $i --query "Reservations[0].Instances[0].PrivateIpAddress" --output text
$ip

You should see something like this:

10.20.11.25

The private IP is known the moment the instance is created, so you can build its DNS record while it’s still booting.

2Create the private hosted zone

Paste this whole block:

$z = aws route53 create-hosted-zone --name saat.internal --caller-reference "lesson19-$(Get-Date -Format yyyyMMddHHmmss)" --vpc "VPCRegion=ap-south-1,VPCId=$($v.VpcId)" --hosted-zone-config Comment=lesson19,PrivateZone=true --query HostedZone.Id --output text
$zone = ($z -split '/')[-1]
aws route53 change-tags-for-resource --resource-type hostedzone --resource-id $zone --add-tags Key=course,Value=saatvedha-aws Key=lesson,Value=19
aws route53 get-hosted-zone --id $zone --query "[HostedZone.Name,HostedZone.Config.PrivateZone,VPCs[0].VPCId]" --output text

You should see something like this:

saat.internal.  True    vpc-0a1b2c3d4e5f67890

The caller reference is a unique string that stops a retried request from creating two zones, and a date stamp does the job nicely.

3Add A, CNAME and TXT records

Paste this whole block:

@'
{
  "Comment": "lesson 19 records",
  "Changes": [
    { "Action": "CREATE", "ResourceRecordSet": { "Name": "app.saat.internal", "Type": "A", "TTL": 60, "ResourceRecords": [ { "Value": "APP_IP" } ] } },
    { "Action": "CREATE", "ResourceRecordSet": { "Name": "db.saat.internal", "Type": "CNAME", "TTL": 60, "ResourceRecords": [ { "Value": "app.saat.internal" } ] } },
    { "Action": "CREATE", "ResourceRecordSet": { "Name": "saat.internal", "Type": "TXT", "TTL": 300, "ResourceRecords": [ { "Value": "\"owner=platform-team\"" } ] } }
  ]
}
'@ -replace 'APP_IP', $ip | Set-Content records.json
$chg = aws route53 change-resource-record-sets --hosted-zone-id $zone --change-batch file://records.json --query ChangeInfo.Id --output text
aws route53 wait resource-record-sets-changed --id $chg
aws route53 list-resource-record-sets --hosted-zone-id $zone --query "ResourceRecordSets[].[Name,Type,TTL]" --output text

You should see this:

saat.internal.  NS      172800
saat.internal.  SOA     900
saat.internal.  TXT     300
app.saat.internal.      A       60
db.saat.internal.       CNAME   60

Route 53 created the NS and SOA records along with the zone, and the waiter returned once your change was INSYNC on every Route 53 server.

Route 53 DNS lab output: dig answers inside the VPC, name not found on the laptop
dig answering inside the VPC, and the laptop that can’t see the private zone. Yours will look much like this.

4Query from inside and outside the VPC

Paste this whole block:

do { Start-Sleep 20; $p = aws ssm describe-instance-information --filters "Key=InstanceIds,Values=$i" --query "InstanceInformationList[0].PingStatus" --output text } until ($p -eq 'Online')
aws ssm start-session --target $i --document-name AWS-StartInteractiveCommand --parameters command="cloud-init status --wait"
aws ssm start-session --target $i --document-name AWS-StartInteractiveCommand --parameters command="dig app.saat.internal +noall +answer"
aws ssm start-session --target $i --document-name AWS-StartInteractiveCommand --parameters command="dig db.saat.internal +short"
aws ssm start-session --target $i --document-name AWS-StartInteractiveCommand --parameters command="dig saat.internal TXT +short"
Resolve-DnsName app.saat.internal

You should see something like this (with the session start and exit lines left out):

status: done
app.saat.internal.      60      IN      A       10.20.11.25
app.saat.internal.
10.20.11.25
"owner=platform-team"
Resolve-DnsName : app.saat.internal : DNS name does not exist

Read the dig answer from left to right: name, TTL in seconds, class, type and value. The CNAME answer shows both hops, the alias and the address it leads to. Your laptop gets “does not exist” because it asks public DNS, and public DNS knows nothing about private zones.

✅ Checkpoint: saat.internal is a private zone linked to saat-vpc, dig on dns01 returns the A, CNAME and TXT answers, and your laptop can’t resolve app.saat.internal. Keep everything for the break lab.

Break It, Then Fix It

Two errors you’ll hit the first time you automate DNS changes: running a script a second time, and deleting a zone.

1Break it: run the same change twice

A teammate runs the deployment script again:

aws route53 change-resource-record-sets --hosted-zone-id $zone --change-batch file://records.json

You’ll get this error:

An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: [Tried to create resource record set [name='app.saat.internal.', type='A'] but it already exists]

CREATE fails when the record already exists, and since a change batch is all or nothing, none of the three changes went through. Fix: use UPSERT, which creates the record or replaces it, so you can run the script as many times as you like:

(Get-Content records.json -Raw) -replace '"CREATE"', '"UPSERT"' | Set-Content records-upsert.json
$chg = aws route53 change-resource-record-sets --hosted-zone-id $zone --change-batch file://records-upsert.json --query ChangeInfo.Status --output text
$chg

You should see this:

PENDING

PENDING is normal, and it turns INSYNC within about a minute.

2Break it: delete a zone that still has records

Try deleting the zone right away:

aws route53 delete-hosted-zone --id $zone

You’ll get this error:

An error occurred (HostedZoneNotEmpty) when calling the DeleteHostedZone operation: The specified hosted zone contains non-required resource record sets and so cannot be deleted.
Route 53 errors: record already exists and HostedZoneNotEmpty, with fixes
Both errors and how to fix them. Yours will look much like this.

Route 53 won’t delete a zone while it still holds your records; only NS and SOA are allowed to remain. Fix: delete your records first. A DELETE has to match the record exactly, TTL and value included, which is where keeping the same JSON file pays off:

(Get-Content records.json -Raw) -replace '"CREATE"', '"DELETE"' | Set-Content records-delete.json
$chg = aws route53 change-resource-record-sets --hosted-zone-id $zone --change-batch file://records-delete.json --query ChangeInfo.Id --output text
aws route53 wait resource-record-sets-changed --id $chg
aws route53 delete-hosted-zone --id $zone --query ChangeInfo.Status --output text
aws ec2 terminate-instances --instance-ids $i | Out-Null
aws ec2 wait instance-terminated --instance-ids $i
.\Stop-SsmEndpoints.ps1
Remove-Item records*.json, dns-userdata.sh
.\Find-LabResources.ps1

The delete-hosted-zone line prints:

PENDING

✅ Checkpoint: You made a record change safe to rerun with UPSERT and deleted a zone properly. The zone, dns01 and the endpoints are all gone.

This happened at work

The cutover that took a day instead of a minute

A payments team was moving its API from old servers to a new load balancer on a Saturday night. The plan looked easy enough: point api.example.com at the new address and switch the old servers off ten minutes later. What nobody had looked at was the record’s TTL, which was 86,400 seconds, set years earlier and never questioned. Lots of partner systems and mobile networks kept using the old address for up to a day, so when the old servers went off a big share of payment calls failed, and at 2 a.m. the team had to switch them back on.

These days their runbook lowers the TTL to 60 seconds two days before any cutover, checks the change with dig against several public resolvers, keeps the old servers running for one full old TTL, and only after that raises the TTL again.

Common mistakes and troubleshooting

MistakeWhat happensWhat to do
Long TTL right before a migrationClients keep hitting the old IP for hoursLower the TTL a few days before the change
Using CREATE in scriptsReruns fail with “already exists”Use UPSERT so changes are idempotent
CNAME at the zone apexInvalidChangeBatch: not permitted at apexUse an alias record at the apex
Private zone not associated with the VPCNames won’t resolve inside that VPCAssociate the zone with every VPC that needs it
Testing private names from a laptopDNS name does not existTest from an instance in the VPC, or set up Route 53 Resolver endpoints
Deleting a zone with recordsHostedZoneNotEmptyDelete your records first, with their exact TTLs and values

Interview questions

Click a question to open it. They’re worded the way an interviewer would ask them, and under each one you’ll find why they ask it and one way to answer, which you should put in your own words.

Fresher level

1. Can you explain in simple words what a hosted zone is in Route 53?

Why they ask this: It’s basic DNS knowledge in AWS, and since public and private zones behave so differently, you need to know both.

How you might answer: It’s a container in Route 53 that holds the DNS records for one domain. It can be public, answering on the internet, or private, answering only inside the VPCs linked to it.

2. What’s the difference between an A record and a CNAME, and is there anywhere you can’t use a CNAME?

Why they ask this: They’re checking the common record types, and the apex rule trips up a lot of people.

How you might answer: An A record maps a name to an IPv4 address, and a CNAME maps a name to another name. The place you can’t use a CNAME is the zone apex, so not on the bare domain like example.com.

3. You changed a DNS record, but some users still see the old address. How would you explain TTL to them?

Why they ask this: It’s DNS caching, which explains most “I changed it but nothing happened” complaints.

How you might answer: I’d tell them TTL means time to live, which is how many seconds resolvers and clients are allowed to cache the answer before asking again. So until the old TTL runs out, some people will keep getting the old address.

2–5 years experience

4. Why would you use a Route 53 alias record instead of a CNAME for your load balancer?

Why they ask this: It’s AWS-specific DNS knowledge. Alias records solve real problems that plain DNS can’t.

How you might answer: An alias points a name at an AWS resource like a load balancer, CloudFront or an S3 website, and unlike a CNAME it works at the zone apex. It also follows the resource’s IP changes by itself, and alias queries to AWS resources aren’t charged.

5. Servers in your office data centre can’t resolve names in a private hosted zone. How would you fix it?

Why they ask this: It’s hybrid DNS, and almost every company running a data centre alongside AWS hits this.

How you might answer: I’d create a Route 53 Resolver inbound endpoint in the VPC and add a conditional forwarder for that domain on the on-premises DNS servers, pointing at the endpoint. For the other direction, where AWS needs to resolve office names, I’d use an outbound endpoint with forwarding rules.

6. Your team wants to release a new version to about 10 percent of users first. How could you do that with DNS?

Why they ask this: They want to hear you know traffic shifting and where it falls short. Being honest about what DNS can’t control shows experience.

How you might answer: I’d use weighted records, 90 on the old target and 10 on the new one, with health checks, and then move the weights step by step. I’d tell the team up front, though, that TTLs and client caching make the split only approximate.

Senior level

7. You have 50 accounts that all need to resolve the same private names. How would you design DNS for that?

Why they ask this: It’s multi-account DNS design. Without a central plan, private zones get copied around and drift apart.

How you might answer: A central networking account would own the private hosted zones and link them to VPCs in the other accounts through authorization, or we’d share Resolver rules through RAM. Resolver endpoints would connect us to on-premises DNS, and Resolver query logging plus DNS Firewall would give us visibility and control.

8. After a DNS change, users in one city can’t reach your site, but everyone else can. How would you investigate?

Why they ask this: They want you to troubleshoot from the source outwards, and problems tied to one location usually come down to caching or split views.

How you might answer: I’d start by checking the record in Route 53 and confirming the change status is INSYNC. Then I’d query the authoritative name servers directly, and after that the public resolvers people in that city tend to use. I’d compare TTLs and cached answers, look for split-horizon zones, and make sure the target itself is healthy.

Quick quiz

Q1. Who can resolve names in a private hosted zone?

  1. Anyone on the internet
  2. Only resources in associated VPCs
  3. Only the root user
  4. Only Route 53 admins
Show answer

B: Private zones are only answered inside the VPCs you associate with them.

Q2. Which action makes a record change safe to run twice?

  1. CREATE
  2. UPSERT
  3. DELETE
  4. REPLACE
Show answer

B: UPSERT creates the record if it’s missing and replaces it if it’s there.

Q3. What is the DNS resolver address in a 10.20.0.0/16 VPC?

  1. 10.20.0.1
  2. 10.20.0.2
  3. 10.20.255.255
  4. 8.8.8.8
Show answer

B: The resolver sits at the VPC base address plus two.

Q4. Why did HostedZoneNotEmpty appear?

  1. The zone had your own records
  2. NS and SOA can’t exist
  3. The VPC was missing
  4. The TTL was too long
Show answer

A: Delete your own records first; NS and SOA are allowed to stay.

Q5. What should you do before a DNS cutover?

  1. Raise the TTL
  2. Lower the TTL in advance
  3. Delete the zone
  4. Turn off health checks
Show answer

B: With a short TTL, clients pick up the change quickly.

Quick recap

  • A hosted zone holds a domain’s records, and private zones only answer inside associated VPCs.
  • Instances query the VPC resolver at the base address plus two.
  • TTL controls caching, so lower it before any cutover.
  • Use UPSERT in scripts, and delete the records before you delete a zone.
  • Routing policies (weighted, failover, latency) move traffic around without any app changes.

Next lesson

Lesson 20: Application Load Balancer → You’ll put two web servers behind an Application Load Balancer, with health checks and listener rules.

Further reading: Route 53 DNS

Want to go deeper into Route 53 DNS? Read Working with private hosted zones and Choosing a routing policy. You can also see the full plan for this course on the AWS Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.