Skip to main content
Current1mo ago

Route 53 DNS Setup

A concise, step-by-step guide to registering a domain, setting up hosted zones, and configuring DNS records in AWS Route 53.


What is Route 53?

Route 53 is AWS's DNS (Domain Name System) service. It does three things:

  1. Domain Registration — buy and manage domain names

  2. DNS Routing — translate domain names to IP addresses

  3. Health Checking — monitor the health of your resources


Step 1: Register a Domain

Console

  1. Go to Route 53 ConsoleRegistered domainsRegister domain

  2. Search for your desired domain name and pick a TLD (.com, .dev, .io, etc.)

  3. Add to cart → Continue

  4. Fill in contact details (registrant, admin, technical)

  5. Enable Privacy Protection (hides your info from WHOIS — always enable this)

  6. Choose Auto-renew on/off

  7. Review → Accept terms → Submit

What happens after registration

  • AWS automatically creates a Hosted Zone with the same name as your domain

  • 4 Name Server (NS) records are assigned to your hosted zone

  • Domain registration can take up to 3 days (usually minutes for .com)

  • You'll receive a verification email — click the link or your domain gets suspended

Pricing

  • Domain fee: varies by TLD (.com is ~$13/year, .dev is ~$14/year)

  • Hosted zone: $0.50/month

  • DNS queries: $0.40 per million queries

  • Domain fee is non-refundable and you cannot change the domain name after registration


Step 2: Understand Hosted Zones

A Hosted Zone is a container for DNS records for a specific domain. Think of it as a folder that holds all the routing rules for your domain.

Public vs Private Hosted Zones

TypePurposeAccessible From
PublicRoutes traffic from the internetAnywhere on the internet
PrivateRoutes traffic within a VPCOnly within associated VPCs

Auto-Created Records

When a hosted zone is created, Route 53 automatically adds:

  • NS Record — lists the 4 name servers assigned to your zone

  • SOA Record — contains admin info about the zone (start of authority)

Tip: If you delete a hosted zone and recreate it, the NS records will be different. You'd need to update the name servers at your registrar.


Step 3: Using Route 53 with an External Registrar

If you bought your domain elsewhere (GoDaddy, Namecheap, Google Domains, etc.):

  1. Create a Public Hosted Zone in Route 53 with your domain name

  2. Copy the 4 NS records from the hosted zone

  3. Go to your registrar's DNS settings → replace their name servers with the Route 53 NS records

  4. Wait for propagation (can take up to 48 hours, usually faster)


Step 4: DNS Record Types

Core Record Types

RecordWhat It DoesExample Value
AMaps domain to IPv4 address192.0.2.1
AAAAMaps domain to IPv6 address2001:0db8::1
CNAMEMaps domain to another domain nameapp.example.com → my-alb.us-east-1.elb.amazonaws.com
MXMail server routing10 mail.example.com
TXTText data (SPF, DKIM, verification)"v=spf1 include:_spf.google.com ~all"
NSDelegates a subdomain to other name serversns-123.awsdns-45.com
CAASpecifies which CAs can issue SSL certs0 issue "amazon.com"

Alias Records (Route 53 Special)

Alias records are a Route 53-specific feature. They work like CNAMEs but with key advantages:

FeatureAliasCNAME
Works at zone apex (example.com)✅ Yes❌ No
Query cost for AWS resourcesFree$0.40/million
TargetsAWS resources onlyAny domain
ResponseReturns actual IP addressesReturns another domain name

Use Alias when pointing to: ALB, CloudFront, S3 website, API Gateway, ECS, Elastic Beanstalk

Use CNAME when pointing to: Non-AWS targets (Vercel, Netlify, Heroku, etc.)

Key Rule: You cannot create a CNAME at the zone apex (example.com). Use an Alias record instead.


Step 5: Create DNS Records

Console

  1. Go to Route 53Hosted zones → select your zone

  2. Click Create record

  3. Switch to Quick create if in wizard view

Common Setups

Point domain to an ALB (Alias)

Record name: (leave blank for apex, or enter "www")
Record type: A
Alias: ON
Route traffic to: Alias to Application and Classic Load Balancer
Region: your ALB's region
Load balancer: select from dropdown

Point subdomain to an EC2 instance (A Record)

Record name: app
Record type: A
Value: 54.123.45.67
TTL: 300

Point subdomain to external service (CNAME)

Record name: blog
Record type: CNAME
Value: my-site.netlify.app
TTL: 300

Set up email with Google Workspace (MX)

Record name: (leave blank)
Record type: MX
Value:
1 ASPMX.L.GOOGLE.COM
5 ALT1.ASPMX.L.GOOGLE.COM
5 ALT2.ASPMX.L.GOOGLE.COM
10 ALT3.ASPMX.L.GOOGLE.COM
10 ALT4.ASPMX.L.GOOGLE.COM
TTL: 3600

SSL Certificate Validation (CNAME)

When using ACM (AWS Certificate Manager):

  1. Request a certificate in ACM

  2. ACM gives you a CNAME name and value

  3. Create the CNAME record in Route 53 (ACM can auto-create this for you)

  4. Wait for validation (usually a few minutes)


Step 6: Routing Policies

PolicyUse Case
SimpleSingle resource, basic routing
WeightedSplit traffic between resources (e.g., 70/30 blue-green deploy)
FailoverActive-passive setup with health checks
LatencyRoute to the lowest-latency region
GeolocationRoute based on user's country/continent
GeoproximityRoute based on geographic distance to resources
Multivalue AnswerReturn multiple healthy IPs (basic load balancing)

Step 7: Health Checks

Health checks monitor your endpoints and can trigger DNS failover.

  1. Go to Route 53Health checksCreate health check

  2. Specify: endpoint IP or domain, port, path (e.g., /health)

  3. Set check interval: 30 seconds (standard) or 10 seconds (fast, costs more)

  4. Set failure threshold (default: 3 consecutive failures)

  5. Link the health check to your DNS record

Health checks cost $0.50/month for AWS endpoints, $0.75/month for non-AWS endpoints.


AWS CLI Reference

Create a Hosted Zone

aws route53 create-hosted-zone \
--name example.com \
--caller-reference "unique-string-$(date +%s)"

Create an A Record

aws route53 change-resource-record-sets \
--hosted-zone-id Z0123456789ABC \
--change-batch '{
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "app.example.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [{"Value": "54.123.45.67"}]
}
}]
}'

Create an Alias Record (ALB)

aws route53 change-resource-record-sets \
--hosted-zone-id Z0123456789ABC \
--change-batch '{
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "example.com",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z35SXDOTRQ7X7K",
"DNSName": "my-alb-123.us-east-1.elb.amazonaws.com",
"EvaluateTargetHealth": true
}
}
}]
}'

List Records in a Hosted Zone

aws route53 list-resource-record-sets \
--hosted-zone-id Z0123456789ABC

Delete a Record


# Same as CREATE but change Action to "DELETE"

# The record values must match exactly


Common Scenarios

Docusaurus Site on S3 + CloudFront

  1. Create S3 bucket → enable static hosting

  2. Create CloudFront distribution → set S3 as origin

  3. Request ACM cert for example.com and www.example.com (must be in us-east-1)

  4. Create Alias A record for example.com → CloudFront distribution

  5. Create Alias A record for www.example.com → CloudFront distribution

Redirect www to apex (or vice versa)

  1. Create S3 bucket named www.example.com

  2. Configure S3 to redirect all requests to example.com

  3. Create Alias A record for www.example.com → S3 website endpoint

Subdomain for API

api.example.com → Alias to ALB or API Gateway


TTL (Time to Live)

TTL tells DNS resolvers how long to cache a record (in seconds).

TTLDurationUse Case
601 minuteDuring migrations or DNS changes
3005 minutesStandard for most records
36001 hourStable records that rarely change
8640024 hoursVery stable records (NS, MX)

Tip: Before making DNS changes, lower TTL to 60s a day in advance. After the change propagates, raise it back.

Note: Alias records don't have TTL — Route 53 uses the target resource's default TTL.


Troubleshooting

Check if DNS is propagated


# Check from specific DNS server
dig example.com @ns-123.awsdns-45.com

# Check A record
dig A example.com

# Check CNAME
dig CNAME www.example.com

# Quick check
nslookup example.com

Common Issues

ProblemFix
Domain not resolvingCheck NS records match between registrar and hosted zone
SSL cert not validatingEnsure CNAME validation record exists in Route 53
CNAME at apex failingUse Alias record instead — CNAME cannot be used at zone apex
Changes not reflectingWait for TTL expiration, or lower TTL before making changes
Alias target not showing in dropdownEnsure resource is in the same account, or enter the DNS name manually

Cost Summary

ResourceCost
Domain registration$9–$75+/year depending on TLD
Hosted zone$0.50/month per zone
Standard DNS queries$0.40/million
Alias queries to AWS resourcesFree
Health checks (AWS endpoints)$0.50/month each
Health checks (non-AWS)$0.75/month each

Related Articles