Turn a domain name into a working address with Route 53: create a hosted zone, add the record types that matter, route traffic with policies like weighted and latency-based routing, and add health checks for failover.
DNS is the internet's phone book: it turns a name like example.com into the IP address of a server. Route 53 is AWS's DNS service. Why "53": port 53 is the DNS port. You use it to point your domain at your load balancer, S3 site, or CloudFront distribution.
List the hosted zones (domains) you already manage
aws route53 list-hosted-zones --query 'HostedZones[].Name'A hosted zone holds all the DNS records for one domain. Why: creating it gives you four AWS "name servers"; you set those at your registrar so the world asks Route 53 for your domain's answers.
Create a hosted zone for your domain
aws route53 create-hosted-zone \
--name example.com \
--caller-reference $(date +%s)Note the four NS records in the output — set these at your domain registrar so Route 53 becomes authoritative for example.com.
A few record types cover most needs. A: name → IPv4 address. CNAME: name → another name. MX: where email goes. TXT: free-form text (used for domain verification). Why care: each points a different kind of traffic to the right place.
Add an A record pointing www at a server IP. Records are changed via a "change batch" JSON document, then submitted in one call. Save as record.json
{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "www.example.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [{ "Value": "203.0.113.10" }]
}
}]
}aws route53 change-resource-record-sets \
--hosted-zone-id Z123456ABCDEFG \
--change-batch file://record.jsonAn "alias" record is a Route 53 extra that points a name straight at an AWS resource (load balancer, CloudFront, S3 site) instead of an IP. Why: those resources' IPs change, and unlike a CNAME an alias can sit at the root domain (example.com, not just www).
Save this as alias.json
{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "example.com",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z35SXDOTRQ7X7K",
"DNSName": "web-alb-123.us-east-1.elb.amazonaws.com",
"EvaluateTargetHealth": true
}
}
}]
}aws route53 change-resource-record-sets \
--hosted-zone-id Z123456ABCDEFG --change-batch file://alias.jsonBeyond plain "always return this IP," Route 53 can route by rule. Weighted: split traffic by percentage (great for gradual rollouts). Latency-based: send users to the closest region. Failover: primary, with a backup if the primary is unhealthy. Geolocation: route by country.
A weighted record sending 10% of traffic to a new version (canary). Save it as weighted.json
{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "api.example.com",
"Type": "A", "TTL": 60,
"SetIdentifier": "v2-canary",
"Weight": 10,
"ResourceRecords": [{ "Value": "203.0.113.50" }]
}
}]
}aws route53 change-resource-record-sets \
--hosted-zone-id Z123456ABCDEFG --change-batch file://weighted.jsonA health check has Route 53 ping an endpoint on a schedule. Paired with a failover routing policy, it stops sending traffic to a dead server and switches to the backup. Why: your domain keeps resolving to something that actually works during an outage.
aws route53 create-health-check \
--caller-reference $(date +%s) \
--health-check-config '{"Type": "HTTPS","FullyQualifiedDomainName": "example.com","Port": 443,"ResourcePath": "/health","RequestInterval": 30,"FailureThreshold": 3}'