By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(For AWS Solutions Architect – Associate & Real-World Deployments)
You’re a cloud engineer at a global e-commerce company. Your website (example.com) runs in three AWS regions (us-east-1, eu-west-1, ap-southeast-1) to serve customers worldwide. One day, your boss asks: - "Why are European users complaining about slow load times?" - "If the US region goes down, how do we automatically fail over to Europe?" - "Can we send 10% of traffic to a new version of our app for testing?"
example.com
Route 53 routing policies are your answer. They let you control how DNS responds to queries based on: - User location (Geolocation, Geoproximity) - Health of endpoints (Failover) - Performance (Latency) - Traffic distribution (Weighted) - Simplicity (Simple)
Why this matters in production:- Without routing policies, all users hit the same endpoint—even if it’s slow or down.- With them, you optimize cost, performance, and reliability. Ignore this, and you’ll either: - Overpay for unused resources (e.g., running all regions 24/7 when only one is needed). - Lose customers due to slow load times or outages. - Fail compliance (e.g., GDPR requires EU data to stay in EU regions).
Real-world scenario:You inherit a legacy app with a single ALB in us-east-1. Users in Asia see 500ms+ latency. Your CTO wants: 1. Asia users → ap-southeast-1 (lowest latency).2. EU users → eu-west-1 (compliance).3. US users → us-east-1 (primary), but fail over to eu-west-1 if it crashes.4. 10% of US traffic → a new beta version (canary testing).
us-east-1
ap-southeast-1
eu-west-1
This guide shows you how to implement all of this in under 30 minutes.
app.example.com
Route 53 needs to know if your endpoints are healthy. Without this, failover won’t work.
CLI Command:
# Create a health check for us-east-1 (HTTP endpoint) aws route53 create-health-check \ --caller-reference $(date +%s) \ --health-check-config '{ "IPAddress": "54.165.123.45", # Replace with your EC2/ALB IP "Port": 80, "Type": "HTTP", "ResourcePath": "/health", "FullyQualifiedDomainName": "app-us.example.com", "RequestInterval": 30, "FailureThreshold": 3 }'
Expected Output:
{ "HealthCheck": { "Id": "abc12345-6789-0def-1234-567890abcdef", "CallerReference": "1625097600", "HealthCheckConfig": { ... }, "HealthCheckVersion": 1 } }
Verify:- Go to Route 53 → Health Checks in the AWS Console.- Check the status (should say "Healthy" after a few minutes).
aws route53 create-hosted-zone \ --name example.com \ --caller-reference $(date +%s) \ --hosted-zone-config '{ "Comment": "Hosted zone for multi-region app", "PrivateZone": false }'
Note: If you already have a hosted zone, skip this.
Route users to the fastest region.
aws route53 change-resource-record-sets \ --hosted-zone-id Z1234567890ABCDEFGHIJ \ --change-batch '{ "Comment": "Latency-based routing for app.example.com", "Changes": [{ "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "us-east-1-latency", "AliasTarget": { "HostedZoneId": "Z35SXDOTRQ7X7K", # ALB/NLB hosted zone ID (varies by region) "DNSName": "app-us.example.com", "EvaluateTargetHealth": true }, "HealthCheckId": "abc12345-6789-0def-1234-567890abcdef", "Region": "us-east-1", "TTL": 60, "ResourceRecords": [] } }, { "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "eu-west-1-latency", "AliasTarget": { "HostedZoneId": "Z32O12XQLNTSW2", # eu-west-1 ALB hosted zone ID "DNSName": "app-eu.example.com", "EvaluateTargetHealth": true }, "HealthCheckId": "def56789-0123-4567-89ab-cdef01234567", "Region": "eu-west-1", "TTL": 60 } }] }'
Key Notes:- SetIdentifier must be unique per record.- AliasTarget is used for ALB/NLB/S3/CloudFront (not EC2 IPs).- EvaluateTargetHealth = true enables Route 53 to check health.
SetIdentifier
AliasTarget
EvaluateTargetHealth
true
aws route53 change-resource-record-sets \ --hosted-zone-id Z1234567890ABCDEFGHIJ \ --change-batch '{ "Comment": "Failover routing for app.example.com", "Changes": [{ "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "us-east-1-primary", "AliasTarget": { "HostedZoneId": "Z35SXDOTRQ7X7K", "DNSName": "app-us.example.com", "EvaluateTargetHealth": true }, "HealthCheckId": "abc12345-6789-0def-1234-567890abcdef", "Failover": "PRIMARY", "TTL": 60 } }, { "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "eu-west-1-secondary", "AliasTarget": { "HostedZoneId": "Z32O12XQLNTSW2", "DNSName": "app-eu.example.com", "EvaluateTargetHealth": true }, "HealthCheckId": "def56789-0123-4567-89ab-cdef01234567", "Failover": "SECONDARY", "TTL": 60 } }] }'
How it works:- If us-east-1 health check fails, Route 53 automatically serves eu-west-1.- Never mix Failover with Latency/Geolocation—it’s one or the other.
Send 10% of traffic to a new version (v2).
v2
aws route53 change-resource-record-sets \ --hosted-zone-id Z1234567890ABCDEFGHIJ \ --change-batch '{ "Comment": "Weighted routing for canary deployment", "Changes": [{ "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "v1-90", "AliasTarget": { "HostedZoneId": "Z35SXDOTRQ7X7K", "DNSName": "app-v1.example.com", "EvaluateTargetHealth": true }, "Weight": 90, "TTL": 60 } }, { "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "v2-10", "AliasTarget": { "HostedZoneId": "Z35SXDOTRQ7X7K", "DNSName": "app-v2.example.com", "EvaluateTargetHealth": true }, "Weight": 10, "TTL": 60 } }] }'
Key Notes:- Weights are relative (90:10 = 90% to v1, 10% to v2).- Set weight to 0 to disable an endpoint.
0
aws route53 change-resource-record-sets \ --hosted-zone-id Z1234567890ABCDEFGHIJ \ --change-batch '{ "Comment": "Geolocation routing for EU users", "Changes": [{ "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "eu-geo", "AliasTarget": { "HostedZoneId": "Z32O12XQLNTSW2", "DNSName": "app-eu.example.com", "EvaluateTargetHealth": true }, "GeoLocation": { "ContinentCode": "EU" }, "TTL": 60 } }, { "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "default-geo", "AliasTarget": { "HostedZoneId": "Z35SXDOTRQ7X7K", "DNSName": "app-us.example.com", "EvaluateTargetHealth": true }, "GeoLocation": { "CountryCode": "*" # Default for all other users }, "TTL": 60 } }] }'
Key Notes:- Order matters! Route 53 evaluates geolocation records from most specific to least specific: 1. Country (e.g., US) 2. Continent (e.g., EU) 3. Default (*) - No health checks here—geolocation overrides them.
US
EU
*
bash dig app.example.com +short
Use a VPN to test from different locations.
Failover Test:
Run dig app.example.com +short → should now return eu-west-1 IP.
dig app.example.com +short
Weighted Test:
route53:ChangeResourceRecordSets
app.internal.example.com
Environment=prod
Purpose=latency-routing
HealthCheckStatus
DNSQueries
NoSuchHostedZone
HostedZoneId
NXDOMAIN
Answer: Weighted (not Latency or Geolocation).
"How to route EU users to eu-west-1 for GDPR compliance?"
Answer: Geolocation (not Latency—users might still hit us-east-1 if it’s faster).
"Primary endpoint fails, but failover doesn’t trigger. Why?"
Answer: Missing health check or EvaluateTargetHealth=false.
EvaluateTargetHealth=false
"How to reduce latency for global users?"
Challenge:You have a website (app.example.com) with: - A primary ALB in us-east-1.- A secondary ALB in eu-west-1.- A new beta version in us-west-2.
us-west-2
Requirements:1. 90% of US traffic → us-east-1.2. 10% of US traffic → us-west-2 (beta).3. All EU traffic → eu-west-1.4. If us-east-1 fails, fail over to eu-west-1.
Solution:```bash
aws route53 create-health-check --caller-reference $(date +%s) --health-check-config '{ "IPAddress": "54.165.123.45", "Port": 80, "Type": "HTTP", "ResourcePath": "/health" }'
aws route53 change-resource-record-sets --hosted-zone-id Z123... --change-batch '{ "Changes": [{ "Action": "CREATE", "ResourceRecordSet": { "Name": "app.example.com", "Type": "A", "SetIdentifier": "us-east-1-90", "AliasTarget": { "HostedZoneId": "Z35SXDOTRQ7X
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.