Traffic Distribution & DNS: Elastic Load Balancing (ELB) & Route 53 Deep Dive
Master enterprise AWS traffic ingress and global DNS: Application Load Balancer (ALB), Network Load Balancer (NLB), Gateway Load Balancer (GLB), Route 53 global routing policies, and disaster recovery failover.
Traffic Distribution & DNS: Elastic Load Balancing (ELB) & Route 53 Deep Dive
Section titled βTraffic Distribution & DNS: Elastic Load Balancing (ELB) & Route 53 Deep DiveβModern enterprise architectures must absorb sudden traffic spikes, isolate failing microservices, and route users across global availability zones with single-digit millisecond latency.
In AWS, this resilience is engineered through two complementary systems:
- Elastic Load Balancing (ELB): Ingress traffic distribution and SSL/TLS termination across compute nodes inside a region.
- Amazon Route 53: Highly available, global authoritative Domain Name System (DNS) with automated health checking and geographic routing.
1. The Elastic Load Balancer (ELB) Family Architecture
Section titled β1. The Elastic Load Balancer (ELB) Family ArchitectureβAWS provides three production load balancers tailored to specific layers of the OSI model:
[ Incoming Client Traffic ] β βββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ βΌ βΌ βΌβββββββββββββββββββββ βββββββββββββββββββββ ββββββββββββββββββββββ Layer 7: ALB β β Layer 4: NLB β β Layer 3/4: GLB ββ HTTP, HTTPS, gRPC β β High-Speed TCP/UDPβ β Transparent Route ββ Path & Host Rules β β Static EIP per AZ β β Network Firewalls ββ TLS & OIDC Auth β β Ultra-low latency β β GENEVE Tunneling ββββββββββββββββββββββ βββββββββββββββββββββ βββββββββββββββββββββComplete Architectural Comparison:
Section titled βComplete Architectural Comparison:β| Feature | Application Load Balancer (ALB) | Network Load Balancer (NLB) | Gateway Load Balancer (GLB) |
|---|---|---|---|
| OSI Layer | Layer 7 (Application) | Layer 4 (Transport) | Layer 3 & 4 (Network/IP) |
| Protocols | HTTP, HTTPS, HTTP/2, gRPC, WebSockets | TCP, UDP, TLS | Raw IP Packets (GENEVE encapsulation) |
| Throughput / Latency | Milliseconds (Evaluates headers & paths) | Microseconds (Millions of RPS) | Line-rate forwarding to appliances |
| Static / Elastic IP | No (Uses dynamic DNS name) | YES: One static Elastic IP per AZ | No |
| SSL/TLS Termination | Offloads TLS via ACM certificates | Offloads TLS via ACM (Extreme speed) | Transparent pass-through |
| Routing Rules | URL path (/api), Host (app.corp.com), HTTP headers, Query string |
Port and protocol mapping only | Routing to virtual firewall fleet |
| Target Types | EC2, ECS, EKS, Lambda, Private IPs | EC2, ECS, EKS, ALB, Private IPs | EC2, Third-party virtual appliances |
2. DevSecOps with Application Load Balancer (ALB)
Section titled β2. DevSecOps with Application Load Balancer (ALB)β1. Centralized SSL/TLS Offloading with ACM
Section titled β1. Centralized SSL/TLS Offloading with ACMβInstead of installing TLS certificates on individual EC2 instances or container pods, terminate TLS at the ALB:
- Uses AWS Certificate Manager (ACM) for automated 90-day certificate renewals (zero manual renewal panic).
- Enforces modern cryptographic ciphers only (
ELBSecurityPolicy-TLS13-1-2-2021-06), dropping legacy insecure SSLv3, TLS 1.0, and TLS 1.1 handshakes at the edge.
2. Path-Based and Host-Based Routing
Section titled β2. Path-Based and Host-Based RoutingβA single ALB can route traffic to dozens of isolated backend target groups, eliminating the cost of provisioning separate load balancers:
resource "aws_lb_listener_rule" "api_routing" { listener_arn = aws_lb_listener.front_end.arn priority = 100
action { type = "forward" target_group_arn = aws_lb_target_group.api_service.arn }
condition { path_pattern { values = ["/api/v1/*"] } }
condition { host_header { values = ["api.devsecopsguru.in"] } }}3. Amazon Route 53: Global DNS Routing Policies
Section titled β3. Amazon Route 53: Global DNS Routing PoliciesβAmazon Route 53 is an authoritative DNS service offering 100% SLA uptime. It does not merely translate domain names to IP addresses; it functions as a global traffic director.
βββββββββββββββββββββββββββββββββββ β Amazon Route 53 Global β β Authoritative DNS β ββββββββββββββββββ¬βββββββββββββββββ β βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββ βΌ βΌ βΌββββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββββ Latency Routing β β Failover Routing β β Geolocation ββ Routes users to β β Active-Passive β β Routes based on ββ closest region β β Disaster Recoveryβ β user continent ββ with lowest RTT β β via Health Checksβ β for data laws βββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββThe 7 Production Routing Policies Explained:
Section titled βThe 7 Production Routing Policies Explained:β- Simple Routing: Standard round-robin DNS mapping a record to one or more IP addresses (No health checks).
- Weighted Routing: Distributes traffic by relative weight percentage (e.g., 95% to current production, 5% to Canary release).
- Latency-Based Routing: Queries AWS global network latency probes and resolves users to the AWS region that provides the lowest round-trip time (RTT).
- Failover Routing: Powers Active-Passive Disaster Recovery. Points traffic to the primary site; if Route 53 health checks detect that the primary site is unhealthy, DNS queries automatically fail over to the secondary DR site.
- Geolocation Routing: Routes traffic based on the geographic location of the DNS query origin (e.g., European queries resolve to Frankfurt for GDPR compliance; Indian queries resolve to Mumbai).
- Geoproximity Routing (Traffic Flow): Routes based on geographic distance with bias adjustments to expand or shrink the catchment area.
- Multi-Value Answer Routing: Returns up to 8 healthy records chosen at random to improve DNS availability across client resolvers.
[!IMPORTANT] The Critical Difference: Alias Records vs. CNAME Records: Standard DNS specifications (RFC 1034) prohibit creating a CNAME record for the Zone Apex (the root domain, e.g.,
devsecopsguru.in). Route 53 Alias Records solve this:
- Acts like a CNAME, but can be placed directly at the Zone Apex.
- Maps directly to AWS resources (ALB, CloudFront, S3 bucket endpoints).
- Free DNS Queries: Route 53 does not charge for queries to Alias records that map to AWS resources!
4. Real-Time Production Triage Runbook
Section titled β4. Real-Time Production Triage RunbookβIncident: ALB Reports All Targets as Unhealthy
Section titled βIncident: ALB Reports All Targets as UnhealthyβSymptom: ALB returns HTTP 502 Bad Gateway or HTTP 503 Service Unavailable. Target Group console shows all EC2/EKS targets in Unhealthy state.
Triage Protocol:
- Inspect Health Check Path: Verify that the Target Group health check path (e.g.,
/healthzor/) matches an actual endpoint that returns HTTP status200 OK. If the app returns301 Redirector401 Unauthorized, the health check fails! - Audit Security Group Ingress on Targets: The backend EC2/EKS instance Security Group must explicitly allow inbound traffic from the ALBβs Security Group on the application port (e.g. 8080).
- Verify Host Process: SSH or use SSM Session Manager to verify the web service is listening:
Terminal window sudo netstat -tulpn | grep :8080 - Inspect Connection Draining / Deregistration Delay: When deploying updates, ensure
deregistration_delay.timeout_secondsis set to at least 30 seconds to allow in-flight HTTP requests to complete before targets are terminated.
π§ Architect Knowledge Check
Section titled βπ§ Architect Knowledge Checkβ1. Why must an Application Load Balancer be deployed across at least two public subnets in different Availability Zones?
Answer: High availability. When you provision an ALB, AWS provisions internal load balancer controller nodes into each designated subnet. Spanning at least two Availability Zones ensures that if one data center or AZ suffers a power outage, the remaining node in the surviving AZ continues handling traffic without interruption.
2. In what specific architectural scenario must an enterprise use a Network Load Balancer (NLB) instead of an Application Load Balancer (ALB)?
Answer:
- Non-HTTP Protocols: When the workload uses raw TCP, UDP, or MQTT (e.g., real-time multiplayer gaming, IoT devices, Syslog UDP streams).
- Static Whitelisted IP Requirements: When enterprise corporate firewalls require whitelisting a single, unchanging static IP address. NLB provides a static Elastic IP per Availability Zone; ALB does not (ALB uses dynamic DNS).
- Extreme Scale / Microsecond Latency: Workloads requiring millions of requests per second with microsecond latency (high-frequency financial trading).