Elastic Load Balancing (ELB)
It distributes incoming traffic across targets (EC2, containers, IP addresses, Lambda) inside a VPC.
See also: generic load balancer concepts.
NGINX, HAProxy, F5 vs ELB
| NGINX / HAProxy (self-managed) | AWS ELB (managed) | |
|---|---|---|
| Patching | self | AWS managed |
| Scaling | Self. Add LB instances + keepalived or DNS round-robin | AWS. Auto-scales with traffic; spans AZs by design |
| Health checks | Self. configure in nginx.conf / haproxy.cfg | AWS. Target group health checks in console/Terraform |
| Layers | NGINX(L7) HTTP; HAProxy(L4/L7) | ALB (L7), NLB (L4), or GWLB (L3 gateway for appliances) |
| Features | Full control: custom modules, WAF rules in nginx, Lua, etc. | ACM (TLS), WAF, Cognito auth (ALB), EKS, Auto Scaling |
| Cost model | For deployment on EC2 | Per-hour + per LCU (capacity unit) / processed bytes |
ALB, NLB, GWLB (often written “GLB”)
| Type | Layer | Best for | Protocols |
|---|---|---|---|
| ELB | L4 - L7 | ||
| ALB — Application Load Balancer | L7 (HTTP/HTTPS) | Web apps, microservices, path/host routing, WebSockets | HTTP, HTTPS, gRPC |
| NLB — Network Load Balancer | L4 (TCP/UDP) | Ultra-low latency, static IP, millions of RPS, TLS passthrough | TCP, UDP, TLS |
| GWLB — Gateway Load Balancer | L3 gateway | Insert third-party appliances (firewall, IDS) in the traffic path | IP packets to appliance fleet |
Block diagram
flowchart LR
Client[Client / Browser]
DNS[Route 53 /DNS]
GLB[Global LB]
RLB[Regional LB]
RLB1[Regional LB1]
subgraph AWS Datacenter
APIGW[API Gateway]
ELB[ELB / ALB]
subgraph EKS["EC2 / EKS"]
Ingress[K8s Ingress]
Pod1[App Svc Pod 1]
Pod2[Pod 2]
Pod3[Pod 3]
end
end
Client -->|IP for google.com| DNS
DNS -->|A record 1.2.3.4| Client
Client -->|HTTP GET https:google.com| GLB
GLB --> RLB
GLB --> RLB1
RLB --> APIGW
APIGW -->|HTTP| ELB
ELB --> Ingress
Ingress --> Pod1
Ingress --> Pod2
Ingress --> Pod3