Load Balancers
AWS Elastic Load Balancing (ELB) is a managed service that automatically distributes incoming application traffic across multiple targets—such as Amazon EC2 instances, Docker containers, IP addresses, and AWS Lambda functions.
Instead of exposing an individual application server directly to the public internet, a load balancer serves as the single, highly available point of contact for clients. It manages traffic distribution, abstracting your backend scaling changes, and protecting resources from running into single-point-of-failure vulnerabilities.
Core Components of ELB Architecture
Every Elastic Load Balancer relies on three basic structural building blocks to process and route network packets:
Listeners: A process on the load balancer that continuously checks for connection requests from clients. It is configured with a specific Protocol (e.g., HTTP, HTTPS, TCP, TLS) and a destination Port (e.g., 80 or 443).
Rules: Attached directly to listeners to dictate how a request is handled. Rules evaluate the structural properties of incoming packets against defined conditions. When a condition evaluates to true, the load balancer triggers a specific action—such as forwarding the request to a backend group, redirecting the user to a completely different URL, or returning a static custom HTTP response code (like a
403 Access Denied).Target Groups: A logical collection of backend resources that you want to distribute traffic to. Each target group tracks the destination port, protocol configuration, and health parameters for its registered assets. An individual target group can be mapped directly to an Auto Scaling Group to absorb newly scaled servers fluidly.
Advanced Cross-Zone Load Balancing & Zonal Shifts
Understanding how load balancers split traffic between geographic facilities is critical for building highly resilient, low-latency microservices:
Cross-Zone Load Balancing: By default, each physical load balancer node provisioned inside a subnet distributes incoming traffic exclusively across the registered targets in its own specific Availability Zone. If Zone A has 2 instances and Zone B has 8 instances, the instances in Zone A will handle disproportionately higher workloads. Enabling Cross-Zone Load Balancing forces the infrastructure to look past zone lines, distributing client traffic evenly across all registered targets across all active zones collectively.
Zonal Shifts: If an underlying AWS Availability Zone experiences a physical infrastructure issue (such as a localized power failure or utility network degradation), you can initiate an explicit Zonal Shift. This command instructs your load balancer to immediately stop routing all incoming traffic to that specific compromised zone. Traffic is rerouted entirely to alternative healthy zones within seconds, keeping your platform accessible while the underlying data center rack recovers.
The Three Primary Load Balancer Types
AWS segments its load-balancing portfolio into specialized services optimized for distinct layers of the OSI network model:
Application Load Balancer (ALB) — Layer 7 (Application) Designed for deep processing of high-level web applications operating over standard HTTP, HTTPS, and gRPC protocols.
Operational Capabilities: Features advanced payload inspection. An ALB can read HTTP headers, evaluate cookie state parameters, inspect query strings, and process explicit URL path vectors. This allows for advanced routing structures, such as directing traffic hitting
example.com/apito a Node.js container fleet while routingexample.com/assetsto a static file group.Advanced Integrations: Integrates natively with AWS WAF for application-layer security filtering, AWS Certificate Manager (ACM) for immediate SSL/TLS decryption offloading, and Amazon Cognito to authenticate user identities before passing requests to your code.
Network Load Balancer (NLB) — Layer 4 (Transport) Engineered for ultra-high performance, massive throughput capacity, and ultra-low latency profiles running over raw TCP, UDP, and TLS lines.
Operational Capabilities: Capable of handling millions of concurrent requests per second while maintaining sub-millisecond latency. The NLB operates purely at the protocol header layer, meaning it does not look inside the application-level data payload.
Static Network Bindings: Unlike an ALB, which uses shifting, dynamic IP addresses, a Network Load Balancer provides one fixed, static Public IP address per enabled Availability Zone. You can also assign an explicit Elastic IP directly to each zone node. This is a critical prerequisite for enterprise customers who must hardcode your destination IPs inside their strict on-premises firewall whitelists.
Gateway Load Balancer (GWLB) — Layer 3 (Network) A specialized virtual gateway designed explicitly to deploy, scale, and manage clusters of third-party virtual appliances.
Operational Capabilities: Acts as a singular entry and exit bump-in-the-wire for all network traffic crossing into or out of your VPC boundaries. It intercepts raw IP packets at Layer 3, encapsulates them using the GENEVE protocol on port 6081, and routes them through a firewalled auto-scaling fleet of inspection devices (such as deep packet inspection tools, next-gen firewalls, or intrusion detection systems).
Failover Handling: If an individual firewall appliance instance suffers an internal operating system crash, the GWLB detects the failure immediately via its background health checks and silently routes subsequent traffic flows to a healthy appliance node without disrupting active application sessions.
Technical Comparison Matrix
| Operational Metric | Application Load Balancer (ALB) | Network Load Balancer (NLB) | Gateway Load Balancer (GWLB) |
| Primary OSI Layer | Layer 7 (Application). | Layer 4 (Transport). | Layer 3 (Network). |
| Supported Protocols | HTTP, HTTPS, gRPC, WebSockets. | TCP, UDP, TLS. | IP (Raw Packets encapsulated via GENEVE). |
| Performance Profile | Optimized for complex feature routing. | Optimized for ultra-low latency and massive spikes. | Optimized for third-party inline security appliances. |
| IP Address Layout | Dynamically changes. Must be mapped via a DNS CNAME record. | Static IP layout. Supports explicit Elastic IP assignment. | Private endpoint architecture within your subnets. |
| Sticky Sessions | Supported (via cookie configuration sets). | Supported (via source IP/port hashing algorithms). | Supported (via 3-tuple or 5-tuple flow tracking). |
| Security Integration | Integrates directly with AWS WAF and Cognito. | Security Groups attached to the NLB endpoints. | Operates as the security data plane driver itself. |