What is AWS Elastic Load Balancing?

Answer

AWS Elastic Load Balancing (ELB) automatically distributes incoming traffic across multiple targets (EC2, Lambda, containers, IP addresses) in one or more AZs, improving availability and fault tolerance. Three types: (1) Application Load Balancer (ALB): Layer 7 (HTTP/HTTPS). Content-based routing — path-based (/api/* → target group A, /web/* → target group B), host-based (api.example.com → API servers), header/query/IP-based, weighted. Supports WebSockets. HTTP/2 support. Lambda targets. Health checks. Ideal for microservices and container-based apps; (2) Network Load Balancer (NLB): Layer 4 (TCP/UDP/TLS). Millions of requests per second with ultra-low latency. Static IP / Elastic IP per AZ. Ideal for gaming, IoT, VoIP, financial apps; (3) Gateway Load Balancer (GWLB): Layer 3 (IP). Deploy, scale, manage third-party network virtual appliances (firewalls, IDS/IPS). Transparent inspection. Key ALB features: Target groups (EC2 instances, ECS tasks, Lambda, IP); Auto Scaling integration; SSL termination; sticky sessions (cookies); access logs; WAF integration; Cognito authentication. Health checks: each load balancer checks target health. Unhealthy targets removed from rotation. Cross-zone load balancing: distribute traffic evenly across all targets in all AZs (ALB always enabled; NLB optional). Connection draining: completes in-flight requests before deregistering a target.