Skip to main content

ELB (Elastic Load Balancing)


logo

Elastic Load Balancing automatically distributes incoming application traffic across multiple targets.


Load Balancer Typesโ€‹

Application Load Balancer (ALB)โ€‹

  • Operates at the application layer (Layer 7: HTTP/HTTPS)
  • Content-based routing: route requests based on URL path, host header, HTTP method, query string, or source IP
  • Supports WebSocket and HTTP/2
  • Native integration with AWS WAF
  • Targets: EC2 instances, containers (ECS), IP addresses, Lambda functions

Network Load Balancer (NLB)โ€‹

  • Operates at the transport layer (Layer 4: TCP/UDP/TLS)
  • Capable of handling millions of requests per second with ultra-low latency
  • Supports static IP addresses and Elastic IPs
  • Preserves the source IP address of the client
  • Targets: EC2 instances, IP addresses, ALB

Gateway Load Balancer (GWLB)โ€‹

  • Operates at the network layer (Layer 3: IP)
  • Designed for deploying, scaling, and managing third-party virtual appliances (e.g. firewalls, IDS/IPS)
  • Combines a transparent network gateway with a load balancer

Classic Load Balancer (CLB)โ€‹

  • Legacy load balancer supporting both Layer 4 and Layer 7
  • Not recommended for new applications; use ALB or NLB instead

Key Conceptsโ€‹

  • Listeners: process that checks for connection requests using the configured protocol and port
  • Target Groups: a group of registered targets (instances, IPs, Lambda) that receive traffic from the load balancer
  • Health Checks: periodic checks to verify that targets are healthy; unhealthy targets stop receiving traffic
  • Availability Zones: load balancers distribute traffic across registered targets in enabled AZs

Cross-Zone Load Balancingโ€‹

  • When enabled, the load balancer distributes traffic evenly across all registered targets in all enabled AZs
  • When disabled, traffic is distributed evenly across AZs, but not across targets within each AZ
  • Enabled by default for ALB; disabled by default for NLB

Sticky Sessionsโ€‹

  • Also known as session affinity
  • Ensures that requests from a client are routed to the same target
  • Supported by ALB and CLB
  • Uses cookies to track the target for each client

SSL/TLS Terminationโ€‹

  • The load balancer can handle SSL/TLS encryption and decryption (offloading)
  • SSL certificates are managed via AWS Certificate Manager (ACM)
  • Backend communication can be encrypted or unencrypted