5.1.2. ELB for Traffic Distribution and HA
š” First Principle: Elastic Load Balancing (ELB) efficiently distributes incoming application traffic across multiple healthy targets, ensuring high availability, fault tolerance, and optimal resource utilization.
Scenario: You need to distribute incoming web traffic across multiple EC2 instances for scalability and ensure that if an instance becomes unhealthy, traffic is automatically routed away from it.
ELB is a core AWS service that automatically distributes incoming application traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in multiple Availability Zones (AZs).
Key Features of ELB for Traffic Distribution and HA:
- Traffic Distribution: Spreads incoming requests across healthy targets, preventing any single target from becoming a bottleneck.
- Health Checks: Continuously monitors the health of registered targets. If a target fails a configured number of health checks, ELB automatically takes it out of rotation and stops sending traffic to it.
- Automatic Deregistration: Unhealthy targets are automatically removed from service.
- Cross-AZ Load Balancing: Distributes traffic across all registered targets in all enabled AZs, even if an AZ experiences issues.
- Scalability: ELB automatically scales its own capacity to handle fluctuations in incoming application traffic.
- Multiple Load Balancer Types:
- Application Load Balancer (ALB): (Layer 7 for HTTP/HTTPS traffic.) Best for web applications, offers advanced routing.
- Network Load Balancer (NLB): (Layer 4 for TCP/UDP traffic.) Designed for extreme performance and static IP addresses.
ā ļø Common Pitfall: Not configuring appropriate health checks for your application, leading to ELB sending traffic to unhealthy instances.
Key Trade-Offs: ALB (more features, Layer 7, but slightly higher latency) versus NLB (extreme performance, Layer 4, static IPs, but fewer features).
Reflection Question: How does Elastic Load Balancing (ELB), with its efficient traffic distribution and continuous health checks, fundamentally ensure high availability and fault tolerance for your application by automatically routing traffic away from unhealthy targets?