Skip to content

Route53


Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service.

Route 53 Overview
+------------------------------------------------------------------+
| |
| +------------------------+ |
| | Route 53 | |
| | (DNS Service) | |
| +------------------------+ |
| | |
| +---------------------+---------------------+ |
| | | | |
| v v v |
| +----------+ +----------+ +----------+ |
| | Domain | | DNS | | Health | |
| | Registration| | Routing | | Checks | |
| | | | Policies | | | |
| +----------+ +----------+ +----------+ |
| |
| Domain Registration: Register and manage domains |
| DNS Routing: Route traffic to AWS resources |
| Health Checks: Monitor endpoint health |
| |
+------------------------------------------------------------------+

DNS Hierarchy
+------------------------------------------------------------------+
| |
| Root (.) |
| | |
| +----------------+----------------+ |
| | | | |
| TLD TLD TLD |
| (.com) (.org) (.net) |
| | | | |
| +----+----+ +----+----+ +----+----+ |
| | | | | | | |
| Domain Domain Domain Domain Domain Domain |
| example.com a.com b.org c.org d.net e.net |
| | |
| +--+--+ |
| | | |
| www api |
| |
| FQDN: www.example.com. (Fully Qualified Domain Name) |
| |
+------------------------------------------------------------------+
DNS Record Types
+------------------------------------------------------------------+
| |
| Record Type | Description |
| ------------|--------------------------------------------------|
| A | Maps domain to IPv4 address |
| AAAA | Maps domain to IPv6 address |
| CNAME | Maps domain to another domain (alias) |
| MX | Mail exchange servers |
| NS | Name servers for the zone |
| PTR | Maps IP to domain (reverse DNS) |
| SOA | Start of authority record |
| SRV | Service location (port, weight, priority) |
| TXT | Text records (SPF, DKIM, verification) |
| CAA | Certificate authority authorization |
| |
| Route 53 Specific: |
| ------------|--------------------------------------------------|
| Alias | Maps to AWS resources (special record type) |
| |
+------------------------------------------------------------------+

Simple Routing Policy
+------------------------------------------------------------------+
| |
| Use Case: Single resource |
| +----------------------------------------------------------+ |
| | | |
| | DNS Query: www.example.com | |
| | | | |
| | v | |
| | +----------+ | |
| | | Route 53 | | |
| | +----------+ | |
| | | | |
| | v | |
| | +----------+ | |
| | | 1.2.3.4 | <-- Single IP returned | |
| | +----------+ | |
| | | |
| +----------------------------------------------------------+ |
| |
| Configuration: |
| { |
| "Name": "www.example.com", |
| "Type": "A", |
| "TTL": 300, |
| "ResourceRecords": ["1.2.3.4"] |
| } |
| |
+------------------------------------------------------------------+
Weighted Routing Policy
+------------------------------------------------------------------+
| |
| Use Case: Load distribution, A/B testing |
| +----------------------------------------------------------+ |
| | | |
| | DNS Query: www.example.com | |
| | | | |
| | v | |
| | +----------+ | |
| | | Route 53 | | |
| | +----------+ | |
| | | | |
| | +----------------+----------------+ | |
| | | | | | |
| | v v v | |
| | +----------+ +----------+ +----------+ | |
| | | Region A | | Region B | | Region C | | |
| | | Weight: 3| | Weight: 2| | Weight: 1| | |
| | | (50%) | | (33%) | | (17%) | | |
| | +----------+ +----------+ +----------+ | |
| | | |
| +----------------------------------------------------------+ |
| |
| Configuration: |
| Record 1: Weight 3 -> Region A |
| Record 2: Weight 2 -> Region B |
| Record 3: Weight 1 -> Region C |
| |
| Probability: Weight_i / Sum(All Weights) |
| |
+------------------------------------------------------------------+
Latency-Based Routing Policy
+------------------------------------------------------------------+
| |
| Use Case: Route to lowest latency endpoint |
| +----------------------------------------------------------+ |
| | | |
| | User Location: US-East | |
| | | | |
| | v | |
| | +----------+ | |
| | | Route 53 | | |
| | | Measures | | |
| | | Latency | | |
| | +----------+ | |
| | | | |
| | +----------------+----------------+ | |
| | | | | | |
| | v v v | |
| | +----------+ +----------+ +----------+ | |
| | | US-East | | EU-West | | AP-South | | |
| | | Latency: | | Latency: | | Latency: | | |
| | | 10ms | | 120ms | | 250ms | | |
| | | SELECTED | | | | | | |
| | +----------+ +----------+ +----------+ | |
| | | |
| +----------------------------------------------------------+ |
| |
| Note: Route 53 maintains latency data between regions |
| and user locations |
| |
+------------------------------------------------------------------+
Failover Routing Policy
+------------------------------------------------------------------+
| |
| Use Case: Active-passive failover |
| +----------------------------------------------------------+ |
| | | |
| | DNS Query: www.example.com | |
| | | | |
| | v | |
| | +----------+ | |
| | | Route 53 | | |
| | | Health | | |
| | | Checks | | |
| | +----------+ | |
| | | | |
| | +----------------+----------------+ | |
| | | | | |
| | v v | |
| | +----------+ +----------+ | |
| | | Primary | | Secondary| | |
| | | (Active) | | (Passive)| | |
| | | Health:OK| | Standby | | |
| | +----------+ +----------+ | |
| | | ^ | |
| | | Failover Scenario | | |
| | v | | |
| | +----------+ +----------+ | |
| | | Primary | -- Health FAIL ----> | Secondary| | |
| | | (Down) | | (Active) | | |
| | +----------+ +----------+ | |
| | | |
| +----------------------------------------------------------+ |
| |
+------------------------------------------------------------------+
Geolocation Routing Policy
+------------------------------------------------------------------+
| |
| Use Case: Location-based routing (country/continent) |
| +----------------------------------------------------------+ |
| | | |
| | User Location: Germany | |
| | | | |
| | v | |
| | +----------+ | |
| | | Route 53 | | |
| | | Geo | | |
| | | Lookup | | |
| | +----------+ | |
| | | | |
| | +----------------+----------------+ | |
| | | | | | |
| | v v v | |
| | +----------+ +----------+ +----------+ | |
| | | US | | EU | | APAC | | |
| | | Endpoint | | Endpoint | | Endpoint | | |
| | | | | SELECTED | | | | |
| | +----------+ +----------+ +----------+ | |
| | | |
| +----------------------------------------------------------+ |
| |
| Location Sources: |
| - Country (e.g., DE, US, JP) |
| - Continent (e.g., Europe, Asia) |
| - Default (catch-all) |
| |
+------------------------------------------------------------------+
Geoproximity Routing Policy
+------------------------------------------------------------------+
| |
| Use Case: Route based on location with bias |
| +----------------------------------------------------------+ |
| | | |
| | Bias: Shift traffic to/from region | |
| | | |
| | Without Bias: | |
| | +----------+ +----------+ | |
| | | Region A | | Region B | | |
| | | 50% | | 50% | | |
| | +----------+ +----------+ | |
| | | |
| | With Bias (Region A: +50): | |
| | +----------+ +----------+ | |
| | | Region A | | Region B | | |
| | | 75% | | 25% | | |
| | | Bias:+50 | | | | |
| | +----------+ +----------+ | |
| | | |
| | Bias Range: -99 to +99 | |
| | Positive: More traffic to region | |
| | Negative: Less traffic to region | |
| +----------------------------------------------------------+ |
| |
+------------------------------------------------------------------+
Multivalue Answer Routing Policy
+------------------------------------------------------------------+
| |
| Use Case: Return multiple IPs, client-side load balancing |
| +----------------------------------------------------------+ |
| | | |
| | DNS Query: www.example.com | |
| | | | |
| | v | |
| | +----------+ | |
| | | Route 53 | | |
| | +----------+ | |
| | | | |
| | v | |
| | Returns up to 8 healthy IPs: | |
| | +----------+ | |
| | | 1.2.3.4 | | |
| | | 1.2.3.5 | | |
| | | 1.2.3.6 | | |
| | +----------+ | |
| | | | |
| | v | |
| | Client selects one IP (random or round-robin) | |
| | | |
| +----------------------------------------------------------+ |
| |
| Features: |
| - Up to 8 healthy records returned |
| - Health checks per record |
| - Client-side load balancing |
| - Simple DNS caching |
| |
+------------------------------------------------------------------+

Alias Records vs CNAME
+------------------------------------------------------------------+
| |
| CNAME Record |
| +----------------------------------------------------------+ |
| | | |
| | Limitations: | |
| | - Cannot use for root domain (example.com) | |
| | - Additional DNS query required | |
| | - Not integrated with AWS services | |
| | | |
| | Example: | |
| | www.example.com -> my-alb.us-east-1.elb.amazonaws.com | |
| | | |
| +----------------------------------------------------------+ |
| |
| Alias Record (Route 53 Specific) |
| +----------------------------------------------------------+ |
| | | |
| | Benefits: | |
| | - Works for root domain (example.com) | |
| | - No additional DNS query | |
| | - Free (no query charges) | |
| | - Automatic IP updates | |
| | | |
| | Supported AWS Resources: | |
| | - CloudFront distributions | |
| | - Elastic Load Balancers | |
| | - API Gateway | |
| | - S3 website buckets | |
| | - VPC interface endpoints | |
| | - Global Accelerator | |
| | | |
| | Example: | |
| | example.com -> ALB (Alias) | |
| | | |
| +----------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

Route 53 Health Checks
+------------------------------------------------------------------+
| |
| Health Check Types |
| +----------------------------------------------------------+ |
| | | |
| | 1. Endpoint Health Check | |
| | - Monitor specific endpoint | |
| | - HTTP/HTTPS/TCP | |
| | - String matching | |
| | | |
| | 2. Calculated Health Check | |
| | - Combine multiple health checks | |
| | - AND/OR logic | |
| | - Parent/child relationship | |
| | | |
| | 3. CloudWatch Alarm Health Check | |
| | - Use CloudWatch alarm as health status | |
| | - Complex metrics | |
| | | |
| +----------------------------------------------------------+ |
| |
| Health Check Configuration |
| +----------------------------------------------------------+ |
| | | |
| | Settings: | |
| | - Protocol: HTTP/HTTPS/TCP | |
| | - Port: 80/443/custom | |
| | - Path: /health | |
| | - Interval: 10s (fast) or 30s (standard) | |
| | - Failure threshold: 3 consecutive failures | |
| | - String matching: "OK" in response body | |
| | | |
| | Locations: | |
| | - Multiple AWS regions | |
| | - Can specify which locations to use | |
| | | |
| +----------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

Route 53 Resolver
+------------------------------------------------------------------+
| |
| Inbound Resolver Endpoint |
| +----------------------------------------------------------+ |
| | | |
| | On-Premises -> AWS VPC | |
| | | |
| | On-Premises AWS VPC | |
| | +------------+ +------------+ | |
| | | DNS Query | | Resolver | | |
| | | for VPC IP |--------->| Endpoint | | |
| | +------------+ | (Inbound) | | |
| | +------------+ | |
| | | | |
| | v | |
| | +------------+ | |
| | | VPC Resource| | |
| | +------------+ | |
| | | |
| +----------------------------------------------------------+ |
| |
| Outbound Resolver Endpoint |
| +----------------------------------------------------------+ |
| | | |
| | AWS VPC -> On-Premises | |
| | | |
| | AWS VPC On-Premises | |
| | +------------+ +------------+ | |
| | | EC2 | | DNS Server | | |
| | | DNS Query |--------->| (On-Prem) | | |
| | +------------+ +------------+ | |
| | | | |
| | v | |
| | +------------+ | |
| | | Resolver | | |
| | | Endpoint | | |
| | | (Outbound) | | |
| | +------------+ | |
| | | |
| +----------------------------------------------------------+ |
| |
| Resolver Rules: |
| +----------------------------------------------------------+ |
| | - Forwarding rules: Forward specific domains | |
| | - System rules: Default VPC DNS | |
| | - Priority: 1-9999 (lower = higher priority) | |
| +----------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

# ============================================================
# Route 53 Zone
# ============================================================
resource "aws_route53_zone" "main" {
name = "example.com"
tags = {
Name = "main-zone"
}
}
# ============================================================
# A Record (Simple)
# ============================================================
resource "aws_route53_record" "www" {
zone_id = aws_route53_zone.main.zone_id
name = "www.example.com"
type = "A"
ttl = 300
records = ["1.2.3.4"]
}
# ============================================================
# Alias Record to ALB
# ============================================================
resource "aws_route53_record" "alb" {
zone_id = aws_route53_zone.main.zone_id
name = "example.com"
type = "A"
alias {
name = aws_lb.main.dns_name
zone_id = aws_lb.main.zone_id
evaluate_target_health = true
}
}
# ============================================================
# Weighted Routing
# ============================================================
resource "aws_route53_record" "weighted_us" {
zone_id = aws_route53_zone.main.zone_id
name = "api.example.com"
type = "A"
weighted_routing_policy {
weight = 70
}
set_identifier = "us-east"
records = ["1.2.3.4"]
}
resource "aws_route53_record" "weighted_eu" {
zone_id = aws_route53_zone.main.zone_id
name = "api.example.com"
type = "A"
weighted_routing_policy {
weight = 30
}
set_identifier = "eu-west"
records = ["5.6.7.8"]
}
# ============================================================
# Latency Routing
# ============================================================
resource "aws_route53_record" "latency_us" {
zone_id = aws_route53_zone.main.zone_id
name = "app.example.com"
type = "A"
latency_routing_policy {
latency_region = "us-east-1"
}
set_identifier = "us-east"
records = ["1.2.3.4"]
}
resource "aws_route53_record" "latency_eu" {
zone_id = aws_route53_zone.main.zone_id
name = "app.example.com"
type = "A"
latency_routing_policy {
latency_region = "eu-west-1"
}
set_identifier = "eu-west"
records = ["5.6.7.8"]
}
# ============================================================
# Failover Routing
# ============================================================
resource "aws_route53_record" "primary" {
zone_id = aws_route53_zone.main.zone_id
name = "failover.example.com"
type = "A"
failover_routing_policy {
type = "PRIMARY"
}
set_identifier = "primary"
records = ["1.2.3.4"]
health_check_id = aws_route53_health_check.primary.id
}
resource "aws_route53_record" "secondary" {
zone_id = aws_route53_zone.main.zone_id
name = "failover.example.com"
type = "A"
failover_routing_policy {
type = "SECONDARY"
}
set_identifier = "secondary"
records = ["5.6.7.8"]
}
# ============================================================
# Geolocation Routing
# ============================================================
resource "aws_route53_record" "geo_us" {
zone_id = aws_route53_zone.main.zone_id
name = "geo.example.com"
type = "A"
geolocation_routing_policy {
country = "US"
}
set_identifier = "us"
records = ["1.2.3.4"]
}
resource "aws_route53_record" "geo_eu" {
zone_id = aws_route53_zone.main.zone_id
name = "geo.example.com"
type = "A"
geolocation_routing_policy {
continent = "EU"
}
set_identifier = "eu"
records = ["5.6.7.8"]
}
resource "aws_route53_record" "geo_default" {
zone_id = aws_route53_zone.main.zone_id
name = "geo.example.com"
type = "A"
geolocation_routing_policy {
country = "*"
}
set_identifier = "default"
records = ["9.10.11.12"]
}
# ============================================================
# Health Check
# ============================================================
resource "aws_route53_health_check" "primary" {
fqdn = "primary.example.com"
port = 443
type = "HTTPS"
resource_path = "/health"
failure_threshold = 3
request_interval = 30
tags = {
Name = "primary-health-check"
}
}
# ============================================================
# Resolver Endpoint
# ============================================================
resource "aws_route53_resolver_endpoint" "inbound" {
name = "inbound-resolver"
direction = "INBOUND"
security_group_ids = [aws_security_group.resolver.id]
ip_address {
subnet_id = aws_subnet.private[0].id
}
ip_address {
subnet_id = aws_subnet.private[1].id
}
tags = {
Name = "inbound-resolver"
}
}
# ============================================================
# Resolver Rule (Forwarding)
# ============================================================
resource "aws_route53_resolver_rule" "forward" {
domain_name = "corp.example.com"
name = "forward-corp"
rule_type = "FORWARD"
resolver_endpoint_id = aws_route53_resolver_endpoint.outbound.id
target_ip {
ip = "10.0.1.10"
}
target_ip {
ip = "10.0.2.10"
}
tags = {
Name = "forward-corp-rule"
}
}
# Associate rule with VPC
resource "aws_route53_resolver_rule_association" "main" {
resolver_rule_id = aws_route53_resolver_rule.forward.id
vpc_id = aws_vpc.main.id
}

Exam Tip

  1. Routing Policies: Simple, Weighted, Latency, Failover, Geolocation, Geoproximity, Multivalue
  2. Alias Records: Free, works for root domain, auto-updates
  3. Health Checks: HTTP/HTTPS/TCP, 10s or 30s intervals
  4. Failover: Active-passive (PRIMARY/SECONDARY)
  5. Latency vs Geolocation: Latency = performance, Geolocation = location
  6. Resolver: Inbound (on-prem to VPC), Outbound (VPC to on-prem)
  7. Resolver Rules: Forward specific domains to on-prem DNS
  8. TTL: Lower = faster changes, higher = less queries
  9. CNAME vs Alias: Alias for AWS resources, CNAME for external
  10. Domain Registration: Route 53 can register domains

Chapter 14: Amazon CloudFront - CDN Service


Last Updated: February 2026