Load Balancing and Route 53 Failover
Overview
Load balancers distribute traffic across healthy targets, and Amazon Route 53 distributes users across endpoints at the DNS layer. Together they provide high availability inside a Region and failover between Regions.
A load balancer is like a hotel concierge directing guests to open elevators, and skipping any that are out of order. Route 53 is the city-level signage that sends visitors to a different hotel entirely if the first one is closed.
The exam covers the load balancer types and their features (connection draining, cross-zone, sticky sessions, slow start), Route 53 routing policies and health checks (including calculated and CloudWatch alarm based), Application Recovery Controller and Global Accelerator as faster alternatives to DNS failover.
Key Concepts
- ALB (L7: HTTP/HTTPS, path/host/header routing, gRPC, WebSockets, Lambda targets, OIDC auth) vs NLB (L4: TCP/UDP/TLS, static IPs, ultra-low latency) vs GWLB (L3 appliance insertion).
- Deregistration delay (connection draining) lets in-flight requests finish, default 300 s; slow start ramps traffic to new targets.
- Cross-zone load balancing is on by default for ALB and off by default for NLB/GWLB; it evens load across AZs.
- Route 53 policies: simple, weighted, latency, failover, geolocation, geoproximity, IP-based and multivalue answer.
- Health checks can monitor an endpoint, other health checks (calculated) or a CloudWatch alarm (for private resources).
- Failover routing uses a primary and secondary record with health evaluation; alias records can evaluate target health.
- Application Recovery Controller (ARC) provides routing controls, readiness checks and zonal shift for reliable, data-plane based failover.
- Global Accelerator gives two static anycast IPs and fails over across Regions in seconds without DNS caching.
Detailed Notes
Load balancer comparison
| Feature | ALB | NLB | GWLB |
|---|---|---|---|
| Layer | 7 | 4 | 3 |
| Protocols | HTTP, HTTPS, gRPC, WebSocket | TCP, UDP, TLS | GENEVE |
| Static / Elastic IP | No (use Global Accelerator) | Yes per AZ | No |
| Preserves client IP | Via X-Forwarded-For | Yes (instance targets) | Yes |
| Typical use | Web apps, microservices | Extreme performance, PrivateLink | Firewalls, inspection |
| Target types | Instance, IP, Lambda | Instance, IP, ALB | Instance, IP |
Resilience features
- Health checks on targets (path, interval, thresholds); unhealthy targets receive no traffic.
- Deregistration delay is the key to zero-downtime deployments: set it near the longest request duration.
- Sticky sessions (cookie) trade even distribution for session affinity; prefer external session stores (ElastiCache/DynamoDB).
- Automatic Target Weights / anomaly mitigation (ALB) detect and shift traffic away from targets with elevated errors.
- ALB access logs to S3 and request tracing (X-Amzn-Trace-Id) support troubleshooting.
Route 53 routing policies
| Policy | Behaviour | Typical use |
|---|---|---|
| Simple | One record, multiple values returned | Single endpoint |
| Weighted | Proportion of responses by weight | Canary, blue/green, A/B |
| Latency | Lowest latency Region | Multi-Region active-active |
| Failover | Primary / secondary on health | Active-passive DR |
| Geolocation | By user location | Compliance, localisation |
| Geoproximity | By distance with bias | Shift load between Regions |
| Multivalue | Up to 8 healthy records | Simple client-side balancing |
Health checks
aws route53 create-health-check --caller-reference app-primary-1 \
--health-check-config Type=HTTPS,FullyQualifiedDomainName=primary.example.com,ResourcePath=/health,RequestInterval=10,FailureThreshold=2
Health checkers sit on the public internet, so a private resource needs a CloudWatch alarm health check. A calculated health check combines children (AND, OR, at least N). Health checks cost extra and fast (10 s) intervals cost more.
Failover record set
{
"Name": "app.example.com", "Type": "A",
"SetIdentifier": "primary", "Failover": "PRIMARY",
"AliasTarget": { "HostedZoneId": "Z35SXDOTRQ7X7K", "DNSName": "primary-alb-123.us-east-1.elb.amazonaws.com", "EvaluateTargetHealth": true },
"HealthCheckId": "abcdef11-2222-3333-4444-555555555555"
}
The matching SECONDARY record points to the DR Region (or an S3 static maintenance page). With EvaluateTargetHealth on an alias to an ALB, Route 53 fails over when no healthy targets remain, without a separate health check.
DNS limits and faster alternatives
DNS failover time = detection time (interval x threshold) + TTL and resolver caching. For faster, deterministic failover:
| Option | Why |
|---|---|
| Global Accelerator | Anycast IPs; endpoint health checked; traffic shifts in under a minute with no DNS caching; traffic dials per endpoint group |
| Route 53 ARC routing controls | Manual or automated on/off switches in a highly available data plane; safety rules prevent turning off both sides |
| CloudFront origin groups | Failover to a secondary origin on 5xx or timeouts |
Zonal shift and autoshift
ARC zonal shift temporarily moves traffic away from one AZ for ALB/NLB (with cross-zone disabled or enabled) when that AZ is impaired; zonal autoshift lets AWS do it for you based on its own observations.
Putting it together: multi-Region active-active
Latency routing in Route 53 (or Global Accelerator) to ALBs in two Regions, each with an ASG and a regional data layer (Aurora Global Database with write forwarding, DynamoDB global tables). Health checks on both Regions with calculated checks that include dependencies; each Region sized to absorb the other's load.
Common pitfalls
- Health check endpoint returning 200 even if dependencies are down (shallow) or failing the whole fleet for one dependency (too deep): design a meaningful check.
- TTL too high on failover records; use 30 to 60 seconds.
- Forgetting that Route 53 health checkers must reach the endpoint (security group must allow the published health checker IP ranges).
Real World Example
Scenario: a bank's customer portal needs a 5 minute failover. The portal runs active-passive: us-east-1 primary, us-west-2 standby. Route 53 failover records use alias to each Region's ALB with EvaluateTargetHealth and a calculated health check that also tests the authentication dependency.
Static customer firewall allowlists led them to put Global Accelerator in front instead, so only two IPs need allowlisting and failover is independent of DNS caching. ARC routing controls with a safety rule let operators fail over deliberately during drills.
Architecture Diagram
DNS sends users to the secondary Region only when the primary is unhealthy.
- 1Route 53 health checkers probe the primary endpoint every 10 or 30 seconds.
- 2While healthy, DNS answers point to the primary Region's ALB.
- 3After the failure threshold, the primary record is marked unhealthy.
- 4DNS answers switch to the secondary Region as caches expire.
- 5When the primary recovers, traffic fails back automatically.
Best Practices
- ✓Use ALB with EvaluateTargetHealth alias records and a meaningful health endpoint.
- ✓Keep TTL low (30-60 s) on failover records.
- ✓Use Global Accelerator or ARC when DNS caching makes failover too slow.
- ✓Set deregistration delay to match request duration for zero-downtime deploys.
- ✓Test failover regularly with game days and ARC routing controls.
Common Interview Questions
Exam Tips
DOP-C02 focus
- "Static IPs for allowlisting" = NLB or Global Accelerator.
- "Fail over without waiting for DNS TTLs" = Global Accelerator (or ARC).
- Private resource health = CloudWatch alarm health check.
- "Route users to nearest Region" = latency routing; "canary percent" = weighted.
Finished this lesson?
0 of 44 lessons done · 0% of the course

