Elastic Load Balancer (ELB)

Elastic Load Balancer (ELB) in AWS - Complete Guide
1. What is ELB?
AWS Elastic Load Balancer (ELB) is a fully managed service that automatically distributes incoming application traffic across multiple targets (EC2 instances, containers, IP addresses) in one or more Availability Zones (AZs).
2. Key Benefits
✔ High Availability - Automatic failover to healthy targets
✔ Fault Tolerance - Distributes traffic across multiple AZs
✔ Scalability - Handles traffic spikes automatically
✔ Security - Integrated with AWS WAF and Shield
✔ Health Checks - Monitors target health
3. Types of ELB
A. Application Load Balancer (ALB)
Layer: 7 (HTTP/HTTPS)
Best For: Web applications, microservices
Features:
Path-based routing (
/api
,/images
)Host-based routing (
api.example.com
)Supports WebSockets, HTTP/2
Integrated with AWS WAF
B. Network Load Balancer (NLB)
Layer: 4 (TCP/UDP/TLS)
Best For: Extreme performance, static IPs
Features:
Ultra-low latency (<100ms)
Static IP/Elastic IP support
Handles millions of requests/sec
Preserves source IP
C. Gateway Load Balancer (GWLB)
Purpose: Deploy 3rd-party virtual appliances
Protocol: GENEVE (port 6081)
Use Cases: Firewalls, intrusion detection
D. Classic Load Balancer (CLB)
Legacy: Avoid for new deployments
Supports: Both Layer 4 and Layer 7
4. Core Components
Component | Description |
Listeners | Checks for connection requests (e.g., HTTPS:443) |
Target Groups | Routes requests to registered targets |
Rules (ALB) | Determines how requests are routed |
Health Checks | Monitors target availability |
5. How ELB Works
Client → Internet → ELB → [Target Group]
├─ EC2 (AZ1)
├─ ECS (AZ2)
└─ Lambda
6. Key Features
Cross-Zone Load Balancing: Even distribution across AZs
SSL/TLS Termination: Offloads encryption/decryption
Sticky Sessions: Route requests to same target
Access Logs: Log all requests to S3
Integration: Works with Auto Scaling, ECS, Lambda
7. Best Practices
✔ Enable deletion protection for production ELBs
✔ Use ACM for SSL certificates (free)
✔ Configure multi-AZ deployment
✔ Set appropriate idle timeout (ALB: 1-4000 sec)
✔ Monitor HTTPCode_ELB_5XX_Count
metric
8. Pricing
ALB: $0.0225/hour + $0.008/LCU*
NLB: $0.0225/hour + $0.006/NLCU*
GWLB: $0.030/hour + $0.005/GLCU*
*LCU = Load Balancer Capacity Unit (based on connections, bandwidth, rule evaluations)
9. Common Use Cases
Blue/Green Deployments
A/B Testing
Multi-tier Applications
Disaster Recovery
10. Limitations
ALB: Max 100 rules per listener
NLB: No HTTP header manipulation
All ELBs: No built-in caching (use CloudFront)
Would you like a step-by-step setup guide for a specific ELB type? 🚀
Subscribe to my newsletter
Read articles from Ravi Vishwakarma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
