Practice Questions
Elastic Load Balancing (ELB)
ELB automatically distributes incoming traffic across multiple targets (EC2 instances, containers, Lambda functions, IP addresses) in one or more Availability Zones. AWS offers three load balancer types.
Application Load Balancer (ALB)
ALB operates at Layer 7 (HTTP/HTTPS). It inspects request content and routes based on rules.
- Path-based routing: route based on URL path (e.g., /api/ → one target group, /images/ → another)
- Host-based routing: route based on the HTTP Host header (e.g., api.example.com vs. app.example.com)
- Header/query-string routing: route based on request headers or query parameters
- Targets: EC2 instances, ECS tasks, Lambda functions, IP addresses (grouped into target groups)
- Supports sticky sessions (session affinity) using cookies — routes a user to the same target for the duration of their session
- Supports WebSockets and HTTP/2
- Best for HTTP/HTTPS microservices and containerized applications
Network Load Balancer (NLB)
NLB operates at Layer 4 (TCP/UDP/TLS). It does not inspect request content — it routes based on connection-level information.
- Capable of handling millions of requests per second with ultra-low latency (single-digit milliseconds)
- Assigns static IP addresses per AZ (or Elastic IPs you provide) — useful when downstream services need to whitelist a fixed IP
- Supports TLS termination
- Best for performance-critical workloads, gaming, IoT, financial trading, and any non-HTTP protocol
Gateway Load Balancer (GWLB)
GWLB operates at Layer 3 (IP). It is used to deploy, scale, and manage third-party virtual network appliances (firewalls, IDS/IPS, deep packet inspection systems). Less commonly tested than ALB and NLB.