Difficulty: Advanced
Explain the Amazon Route 53 routing policies. Pick three and describe a real use case for each.
Route 53 routing policies decide which answer a DNS query gets when a record name has more than one possible target. The main ones are simple, weighted, latency, failover, geolocation, geoproximity, IP-based, and multivalue answer. Three you should be able to explain cold are latency-based (send users to the fastest Region), failover (active-passive disaster recovery driven by health checks), and weighted (split traffic by percentage, for example a 5% canary release).
| Policy | What decides the answer | Typical use |
|---|---|---|
| Simple | One record, no logic | A single web server or ALB |
| Weighted | Relative weights you assign | Canary releases, A/B tests, gradual migration |
| Latency | Lowest measured latency from the user's network to an AWS Region | Multi-Region apps |
| Failover | Health check on the primary | Active-passive DR |
| Geolocation | User's continent, country, or state | Compliance, localised content |
| Geoproximity | Distance to resources, adjustable with a bias | Shifting traffic between regions by location |
| IP-based | The resolver's or client's CIDR block | Routing specific ISPs or networks |
| Multivalue answer | Up to 8 healthy records returned at random | Simple client-side load spreading |
You create records with the same name in, say, ap-south-1 (Mumbai) and eu-west-1 (Ireland). Route 53 uses AWS's latency measurements between networks and Regions to return the record with the lowest latency for that user. An Indian user typically gets Mumbai, a German user gets Ireland. Note this is latency, not geography: a user near a border may get the "farther" Region if the network path is faster.
You mark one record primary and attach a health check, and another secondary (often a static S3 maintenance page or a standby Region). While the primary is healthy, everyone gets it. When the health check fails, Route 53 starts answering with the secondary. Recovery time depends on the health check interval and failure threshold plus the record TTL, because resolvers cache the old answer until TTL expires. Keep TTLs low (60 seconds) on failover records.
Each record gets a weight from 0 to 255, and traffic is split proportionally. Weights of 95 and 5 send roughly 5% of DNS answers to the new version. Setting a weight to 0 takes a target out of rotation without deleting it. Because clients and resolvers cache DNS, the split is approximate; for precise percentages per request, use ALB weighted target groups instead.
Real setups nest them. For example: latency routing chooses the Region, and inside each Region a failover or weighted record chooses between a primary and backup. Alias records let you point at ALBs, CloudFront, or S3 websites at the zone apex (example.com), which a CNAME cannot do, and alias queries to AWS resources are free.
A few gotchas:
{
"Comment": "Canary 5% to v2",
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "api.example.com", "Type": "CNAME", "TTL": 60,
"SetIdentifier": "v1", "Weight": 95,
"ResourceRecords": [{ "Value": "v1-alb.ap-south-1.elb.amazonaws.com" }]
}
},
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "api.example.com", "Type": "CNAME", "TTL": 60,
"SetIdentifier": "v2", "Weight": 5,
"ResourceRecords": [{ "Value": "v2-alb.ap-south-1.elb.amazonaws.com" }]
}
}
]
}
Apply with aws route53 change-resource-record-sets --hosted-zone-id Z123 --change-batch file://canary.json. SetIdentifier distinguishes records that share a name.
Route 53, Routing Policies, Health Checks, Latency-based Routing, Failover Routing