Skip to content
About Me
----

Traffic Distribution & DNS: Elastic Load Balancing (ELB) & Route 53 Deep Dive

Architect Key Takeaways

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:

  1. Elastic Load Balancing (ELB): Ingress traffic distribution and SSL/TLS termination across compute nodes inside a region.
  2. 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 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
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

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.

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"]
}
}
}

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 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. Simple Routing: Standard round-robin DNS mapping a record to one or more IP addresses (No health checks).
  2. Weighted Routing: Distributes traffic by relative weight percentage (e.g., 95% to current production, 5% to Canary release).
  3. Latency-Based Routing: Queries AWS global network latency probes and resolves users to the AWS region that provides the lowest round-trip time (RTT).
  4. 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.
  5. 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).
  6. Geoproximity Routing (Traffic Flow): Routes based on geographic distance with bias adjustments to expand or shrink the catchment area.
  7. 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!

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:

  1. Inspect Health Check Path: Verify that the Target Group health check path (e.g., /healthz or /) matches an actual endpoint that returns HTTP status 200 OK. If the app returns 301 Redirect or 401 Unauthorized, the health check fails!
  2. 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).
  3. Verify Host Process: SSH or use SSM Session Manager to verify the web service is listening:
    Terminal window
    sudo netstat -tulpn | grep :8080
  4. Inspect Connection Draining / Deregistration Delay: When deploying updates, ensure deregistration_delay.timeout_seconds is set to at least 30 seconds to allow in-flight HTTP requests to complete before targets are terminated.

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:

  1. Non-HTTP Protocols: When the workload uses raw TCP, UDP, or MQTT (e.g., real-time multiplayer gaming, IoT devices, Syslog UDP streams).
  2. 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).
  3. Extreme Scale / Microsecond Latency: Workloads requiring millions of requests per second with microsecond latency (high-frequency financial trading).