Route 53: DNS for your apps
Create a private hosted zone in the console, add A, CNAME and alias records, pick a routing policy, add health checks, and clean up without buying a domain.
By the end of this lesson you'll be able to
0 of 5 completeDNS in one minute
Before DNS, a client would need a server's IP address written directly into configuration. When the server moved, every client with the old address had to be updated. DNS lets a client ask for a stable name and receive the address selected by a resolver.
Domain Name System (DNS) maps names such as api.example.com to records that clients can use. Amazon Route
53 hosts DNS zones and answers queries; it can also check endpoint health and register domains. A resolver asks
the authoritative servers for the record, caches the answer for its time to live (TTL), and returns it to the
client. The name Route 53 refers to DNS's port number, 53.
Everything below was done in a real practice account with a private zone, which costs nothing if deleted within 12 hours, and then deleted. No domain was bought and no public DNS changed.
In this lesson you'll create a private hosted zone linked to a VPC, add records and inspect routing policies. Private DNS answers are visible only to associated VPCs, so this exercise does not change a public website.
Hosted zones
A hosted zone is the authoritative container for records under a domain name. Without a zone, the DNS
system has no place where your team can define the answers for academy.internal or example.com. Route 53
offers public zones, queried through public DNS, and private zones, associated with one or more VPCs.
When a resolver asks about a name, Route 53 finds the matching zone and returns the record data and TTL. A private zone answers only for queries coming from associated VPCs with DNS support enabled. A public zone is reachable through the public DNS hierarchy, but creating it alone does not make it authoritative for a registered domain; the registrar's name-server delegation must point to it.
The two kinds of zone serve different audiences:
| Zone | Answers | Use for |
|---|---|---|
| Public | anyone on the internet | your website and APIs (example.com) |
| Private | only from VPCs you associate with it | internal service names (db.academy.internal) |
Route 53 → Hosted zones → Create hosted zone:
A private zone needs the VPC's DNS hostnames and DNS resolution settings turned on; the default VPC and lesson 4's wizard VPC have both. A new zone starts with two records Route 53 manages for you: NS (the name servers answering for the zone) and SOA (zone metadata).
Use a private zone for internal service names and a public zone for names customers must resolve on the internet. A common mistake is creating a public zone and assuming the domain now points to it. Change the registrar's name-server delegation only when you intend to move live DNS; this lesson uses a private zone and does not touch a public domain.
Records
| Type | Points to | Example |
|---|---|---|
| A / AAAA | an IPv4 / IPv6 address | api.academy.internal → 10.0.0.10 |
| CNAME | another name (never at the zone apex) | www → web.academy.internal |
| Alias | an AWS resource: ALB, CloudFront, S3 website, another record | example.com → my-alb-123.elb.amazonaws.com |
| MX / TXT | mail servers / text, such as domain verification | TXT "v=spf1 …" |
Alias is Route 53's own record: it works at the zone apex (example.com itself, where CNAMEs aren't
allowed), follows the target's IP addresses as they change, and queries to AWS targets are free. Point domains at
lesson 5's load balancer or lesson 9's CloudFront with an alias.
TTL (time to live) is how long resolvers cache an answer. 300 seconds is a sensible default; lower it a day before a planned change so the switch spreads quickly.
Routing policies
The record wizard shows every policy:
| Policy | Answers with | Use for |
|---|---|---|
| Simple | the same value for everyone | one endpoint |
| Weighted | each record in proportion to its weight | canary releases: 90% old, 10% new |
| Latency | the Region with the lowest latency to the user | apps running in several Regions |
| Failover | primary while healthy, otherwise secondary | disaster recovery |
| Geolocation | by the user's country or continent | legal or language requirements |
| Multivalue | up to eight healthy records at random | simple client-side spreading |
Health checks
Attach a health check to a failover or weighted record, and Route 53 stops returning an unhealthy answer. Check a
path that proves the app works (/health that touches the database), not just that a port is open. Health checks
cost a little per month each, so this lesson only opened the form.
Domain registration
When a team needs a new public name, it must register the domain with a registrar and then publish the DNS records that direct traffic to its services. Route 53 can act as both registrar and DNS host, but those are separate jobs: registration reserves the name; a hosted zone contains its records.
Registered domains → Register domains purchases a domain through Route 53 and creates its public hosted zone. If a domain is registered elsewhere, create the zone and update the registrar's name-server delegation to the four servers in its NS record. DNS changes can take time to propagate because resolvers cache answers. Registration costs money and renews yearly, so it is not part of a practice mission.
Register through Route 53 only when its pricing, supported suffix and renewal terms fit the requirement. If you already own the domain elsewhere, keep the registrar and delegate DNS to Route 53 instead. A common mistake is treating a zone as proof that you own a domain; only registration gives you that ownership, and a public zone that is not delegated will not answer authoritative lookups for visitors.
Route 53 refuses to delete a hosted zone that still has records other than NS and SOA. Delete your records first, then the zone. A hosted zone kept longer than 12 hours is billed for the month.
Keep public zones in code (Terraform or CloudFormation), use alias records for AWS endpoints, keep TTLs short around migrations, use private zones for internal names instead of hard-coded IPs, and protect the domain with registrar lock and auto-renew so it can never lapse.
Private DNS for a VPC
Create a private hosted zone attached to your default VPC, add two A records and a CNAME, list them, then delete the records and the zone and confirm it's gone.
Five records (NS, SOA, two A, one CNAME), then no academy.internal zoneReveal one safe solution
$ VPC=$(aws ec2 describe-vpcs --filters Name=isDefault,Values=true --query 'Vpcs[0].VpcId' --output text) $ Z=$(aws route53 create-hosted-zone --name academy.internal --caller-reference academy-$RANDOM \ --vpc VPCRegion=ap-south-1,VPCId=$VPC --query HostedZone.Id --output text) $ cat > rec.json <<'EOF' {"Changes":[ {"Action":"CREATE","ResourceRecordSet":{"Name":"api.academy.internal","Type":"A","TTL":300,"ResourceRecords":[{"Value":"10.0.0.10"}]}}, {"Action":"CREATE","ResourceRecordSet":{"Name":"web.academy.internal","Type":"A","TTL":300,"ResourceRecords":[{"Value":"10.0.0.20"}]}}, {"Action":"CREATE","ResourceRecordSet":{"Name":"www.academy.internal","Type":"CNAME","TTL":300,"ResourceRecords":[{"Value":"web.academy.internal"}]}}]} EOF $ aws route53 change-resource-record-sets --hosted-zone-id $Z --change-batch file://rec.json $ aws route53 list-resource-record-sets --hosted-zone-id $Z --query 'ResourceRecordSets[].[Name,Type,ResourceRecords[0].Value]' --output text academy.internal. NS ns-1536.awsdns-00.co.uk. academy.internal. SOA ns-1536.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400 api.academy.internal. A 10.0.0.10 web.academy.internal. A 10.0.0.20 www.academy.internal. CNAME web.academy.internal $ sed 's/"CREATE"/"DELETE"/g' rec.json > del.json $ aws route53 change-resource-record-sets --hosted-zone-id $Z --change-batch file://del.json $ aws route53 delete-hosted-zone --id $Z $ aws route53 list-hosted-zones-by-name --dns-name academy.internal --query 'HostedZones[?Name==`academy.internal.`]' []
cat > rec.json <<'EOF'catprint a file>write output to a file, replacing it
aws route53 change-resource-record-sets --hosted-zone-id $Z --change-batch file://rec.jsonawsthe AWS command line
aws route53 list-resource-record-sets --hosted-zone-id $Z --query 'ResourceRecordSets[].[Name,Type,ResourceRecords[0].Value]' --output text--querypick fields from the JSON response--outputoutput format
Your name servers will differ. A delete batch must match each record exactly, which is why reusing the create
file with DELETE is the safe way to remove them.
Try it yourself
0 of 4 steps doneRun each task in your own account or terminal, then tick it off.
Quick check
Which hosted zone resolves names only inside associated VPCs?
Official reading for this lesson
Or get every quiz answer right and it completes itself.
Something unclear, wrong or out of date in this lesson? Tell me, and I'll fix it.