3. Traffic Flow Diagrams
3.1 Basic DNS Resolution Flow
sequenceDiagram
participant Client
participant ISP_DNS as ISP DNS Resolver
participant Route53 as Route 53
participant WebServer as Web Server
Client->>ISP_DNS: DNS Query for example.com
ISP_DNS->>Route53: Forward DNS Query
Route53->>Route53: Check Hosted Zone
Route53->>Route53: Apply Routing Policy
Route53->>Route53: Check Health Status
Route53->>ISP_DNS: Return IP Address
ISP_DNS->>Client: Return IP Address
Client->>WebServer: HTTP Request to IP
WebServer->>Client: HTTP Response
DNS Resolution Flow: This sequence shows how a client's DNS request travels through the ISP's DNS resolver to Route 53, where the hosted zone is checked, routing policies are applied, health checks are verified, and the appropriate IP address is returned to route the client to the healthy endpoint.
3.2 Multi-Region Failover Traffic Flow
graph TB
subgraph "Client Request"
A[User Request] --> B[Route 53 DNS]
end
subgraph "Route 53 Decision Logic"
B --> C{Health Check Status}
C -->|Primary Healthy| D[Route to Primary]
C -->|Primary Unhealthy| E[Route to Secondary]
end
subgraph "Primary Region - us-east-1"
D --> F[Primary ALB]
F --> G[Primary EC2 Instances]
H[Primary Health Check] --> G
end
subgraph "Secondary Region - us-west-2"
E --> I[Secondary ALB]
I --> J[Secondary EC2 Instances]
K[Secondary Health Check] --> J
end
H --> C
K --> C
Multi-Region Failover: This diagram illustrates how Route 53 implements disaster recovery by routing traffic to a primary region when healthy, and automatically failing over to a secondary region when health checks detect issues with the primary infrastructure.
3.3 Weighted Routing Distribution
graph TB
A[User Requests] --> B[Route 53 Weighted Routing]
B --> C{Weight Distribution}
C -->|70% Weight| D[Production Environment]
C -->|20% Weight| E[Staging Environment]
C -->|10% Weight| F[Canary Environment]
D --> G[Prod Load Balancer]
E --> H[Staging Load Balancer]
F --> I[Canary Load Balancer]
G --> J[Production Fleet]
H --> K[Staging Fleet]
I --> L[Canary Fleet]
Weighted Routing: This shows how Route 53 can distribute traffic across multiple endpoints based on assigned weights, enabling blue-green deployments, canary releases, and load distribution scenarios.
5. Detailed Configurations
5.1 Creating a Hosted Zone
aws route53 create-hosted-zone \
--name example.com \
--caller-reference $(date +%s) \
--hosted-zone-config Comment="Production hosted zone for example.com"
Parameter Explanation:
- --name: The domain name for the hosted zone
- --caller-reference: A unique string that identifies the request (prevents duplicate creation)
- --hosted-zone-config: Optional configuration with comment for documentation
What this does: Creates a hosted zone that will contain all DNS records for your domain. This is the foundational step that must be completed before creating any DNS records.
5.2 Creating Health Checks
aws route53 create-health-check \
--caller-reference health-check-$(date +%s) \
--health-check-config '{
"Type": "HTTPS",
"ResourcePath": "/health",
"FullyQualifiedDomainName": "api.example.com",
"Port": 443,
"RequestInterval": 30,
"FailureThreshold": 3,
"EnableSNI": true,
"Regions": ["us-east-1", "us-west-2", "eu-west-1"]
}'
Health Check Parameters:
- Type: HTTP, HTTPS, or TCP
- ResourcePath: The path to check (for HTTP/HTTPS)
- FullyQualifiedDomainName: The domain or IP to check
- Port: Port number to check
- RequestInterval: 10 or 30 seconds between checks
- FailureThreshold: Number of consecutive failures before marking unhealthy
- EnableSNI: Enable Server Name Indication for HTTPS
- Regions: AWS regions to perform health checks from
Purpose: Health checks monitor the availability of your endpoints. They run from multiple AWS regions and can check HTTP/HTTPS endpoints or TCP ports.
5.3 Creating Failover Records
aws route53 change-resource-record-sets \
--hosted-zone-id Z1234567890ABC \
--change-batch '{
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "api.example.com",
"Type": "A",
"SetIdentifier": "primary",
"Failover": "PRIMARY",
"TTL": 60,
"ResourceRecords": [
{"Value": "203.0.113.10"}
],
"HealthCheckId": "12345678-1234-1234-1234-123456789012"
}
}
]
}'
Failover Record Parameters:
- SetIdentifier: Unique identifier for this record set
- Failover: PRIMARY or SECONDARY
- TTL: Time to Live in seconds (how long DNS resolvers cache the record)
- ResourceRecords: Array of IP addresses or values
- HealthCheckId: ID of the health check to associate with this record
Configuration Order: Create the primary record first, then create the secondary record with "Failover": "SECONDARY". The health check determines which record is returned.
aws route53 change-resource-record-sets \
--hosted-zone-id Z1234567890ABC \
--change-batch '{
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "api.example.com",
"Type": "A",
"SetIdentifier": "secondary",
"Failover": "SECONDARY",
"TTL": 60,
"ResourceRecords": [
{"Value": "203.0.113.20"}
],
"HealthCheckId": "87654321-4321-4321-4321-210987654321"
}
}
]
}'
Secondary Record: This creates the failover target. Route 53 will only return this record when the primary record's health check fails. Both primary and secondary records should have health checks for optimal reliability.
5.4 Weighted Routing Records
aws route53 change-resource-record-sets \
--hosted-zone-id Z1234567890ABC \
--change-batch '{
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "www.example.com",
"Type": "A",
"SetIdentifier": "production-70",
"Weight": 70,
"TTL": 300,
"ResourceRecords": [
{"Value": "203.0.113.30"}
],
"HealthCheckId": "prod-health-check-id"
}
}
]
}'
Weight Configuration:
- Weight: Relative weight (0-255) for this record
- SetIdentifier: Must be unique across all weighted records for the same name
Traffic Distribution: If you have weights of 70, 20, and 10, traffic will be distributed proportionally (70%, 20%, 10%). Create multiple weighted records for the same domain name to distribute traffic.
5.5 Latency-Based Routing
aws route53 change-resource-record-sets \
--hosted-zone-id Z1234567890ABC \
--change-batch '{
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "global.example.com",
"Type": "A",
"SetIdentifier": "us-east-1-endpoint",
"Region": "us-east-1",
"TTL": 300,
"ResourceRecords": [
{"Value": "203.0.113.40"}
],
"HealthCheckId": "us-east-health-check"
}
}
]
}'
Latency Routing Parameters:
- Region: AWS region where this resource is located
- SetIdentifier: Unique identifier for this latency record
How it works: Route 53 maintains latency data between AWS regions and user locations. It automatically routes users to the region with the lowest latency. Create one latency record per region.
5.6 Geolocation Routing
aws route53 change-resource-record-sets \
--hosted-zone-id Z1234567890ABC \
--change-batch '{
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "geo.example.com",
"Type": "A",
"SetIdentifier": "north-america",
"GeoLocation": {
"ContinentCode": "NA"
},
"TTL": 300,
"ResourceRecords": [
{"Value": "203.0.113.50"}
],
"HealthCheckId": "na-health-check"
}
}
]
}'
Geolocation Options:
- ContinentCode: Two-letter continent code (NA, SA, EU, AS, AF, OC, AN)
- CountryCode: Two-letter country code (US, CA, DE, etc.)
- SubdivisionCode: State/province code (requires CountryCode)
Default Record: Always create a default geolocation record (no location specified) to handle requests from unmatched locations.
5.7 ALIAS Records for AWS Resources
aws route53 change-resource-record-sets \
--hosted-zone-id Z1234567890ABC \
--change-batch '{
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "cdn.example.com",
"Type": "A",
"AliasTarget": {
"DNSName": "d123456789.cloudfront.net",
"EvaluateTargetHealth": false,
"HostedZoneId": "Z2FDTNDATAQYW2"
}
}
}
]
}'
ALIAS Record Benefits:
- DNSName: The AWS resource's DNS name
- HostedZoneId: The hosted zone ID of the AWS service
- EvaluateTargetHealth: Whether to check the target's health
Why use ALIAS: ALIAS records are free (no charge for queries), automatically resolve to IP addresses, and can be used for zone apex records (@). They're preferred over CNAME records for AWS resources.
7. Health Checks Configuration
7.1 HTTP/HTTPS Health Check
aws route53 create-health-check \
--caller-reference web-health-$(date +%s) \
--health-check-config '{
"Type": "HTTPS",
"ResourcePath": "/api/health",
"FullyQualifiedDomainName": "api.example.com",
"Port": 443,
"RequestInterval": 30,
"FailureThreshold": 3,
"MeasureLatency": true,
"EnableSNI": true,
"Regions": ["us-east-1", "us-west-2", "eu-west-1"],
"AlarmIdentifier": {
"Region": "us-east-1",
"Name": "api-health-alarm"
},
"InsufficientDataHealthStatus": "LastKnownStatus"
}'
Advanced Health Check Options:
- MeasureLatency: Enable latency measurements
- AlarmIdentifier: CloudWatch alarm to monitor
- InsufficientDataHealthStatus: Failure, Success, or LastKnownStatus
- SearchString: String to search for in response body
Best Practice: Use health checks that match your application's actual health endpoint. Set appropriate failure thresholds and request intervals based on your availability requirements.
7.2 Calculated Health Check
aws route53 create-health-check \
--caller-reference calculated-health-$(date +%s) \
--health-check-config '{
"Type": "CALCULATED",
"ChildHealthChecks": [
"12345678-1234-1234-1234-123456789012",
"87654321-4321-4321-4321-210987654321"
],
"HealthThreshold": 1,
"CloudWatchAlarmRegion": "us-east-1",
"InsufficientDataHealthStatus": "Failure"
}'
Calculated Health Check:
- ChildHealthChecks: Array of health check IDs to monitor
- HealthThreshold: Minimum number of healthy children required
Use Case: Calculated health checks are useful for complex scenarios where you need to monitor multiple endpoints and define custom logic for what constitutes "healthy."