Elastic Load Balancer (ELB) is a fully managed AWS service that automatically distributes incoming application traffic across multiple targets such as:
- EC2 instances
- Containers
- IP addresses
- Lambda functions
Why Load Balancers are Needed
Imagine an application running on a single EC2 instance.
Users
|
Single EC2 Instance
Problems:
- Single point of failure
- Cannot handle high traffic
- Poor scalability
- Downtime risk
Solution Using ELB
Users
|
Elastic Load Balancer
/ | \
EC2-1 EC2-2 EC2-3
ELB distributes requests across multiple servers.
Main Responsibilities of ELB
| Feature | Purpose |
|---|---|
| Traffic Distribution | Spread requests across targets |
| High Availability | Reduce downtime |
| Health Checks | Detect unhealthy instances |
| Auto Scaling Integration | Support dynamic scaling |
| SSL Termination | Handle HTTPS traffic |
How ELB Works Internally
Client Request
|
DNS Resolution
|
Elastic Load Balancer
|
Health Check Validation
|
Forward Request to Healthy Target
|
Application Response
Core Components of ELB
- Listener
- Target Group
- Health Checks
- Routing Rules
- Availability Zones
1. Listener
Listener defines:
Protocol + Port
Examples
HTTP : 80
HTTPS : 443
TCP : 3306
2. Target Group
A target group contains backend targets:
- EC2 instances
- Containers
- IP addresses
- Lambda functions
Architecture
Load Balancer
|
Target Group
|
-------------------
| | |
EC2-1 EC2-2 EC2-3
3. Health Checks
ELB continuously checks:
Whether backend servers are healthy
Example
GET /health
Health Check Flow
ELB
|
Health Check
|
Healthy Instance → Traffic Sent
Unhealthy Instance → Traffic Stopped
Benefits
- Automatic failure handling
- Improved availability
Types of Elastic Load Balancers
| Type | Layer | Use Case |
|---|---|---|
| Application Load Balancer (ALB) | Layer 7 | HTTP/HTTPS applications |
| Network Load Balancer (NLB) | Layer 4 | High-performance TCP/UDP traffic |
| Gateway Load Balancer (GWLB) | Layer 3/4 | Security appliances |
| Classic Load Balancer (CLB) | Legacy | Older AWS applications |
1. Application Load Balancer (ALB)
ALB works at:
OSI Layer 7 (Application Layer)
Supports
- HTTP
- HTTPS
- Path-based routing
- Host-based routing
- Microservices
Architecture
Users
|
ALB
|
---------------------------------
| | |
/api /payment /orders
| | |
Service-A Service-B Service-C
Use Cases
- Microservices
- Web applications
- Kubernetes ingress
2. Network Load Balancer (NLB)
NLB works at:
OSI Layer 4 (Transport Layer)
Supports
- TCP
- UDP
- TLS
Features
- Ultra-low latency
- Millions of requests per second
- Static IP support
Use Cases
- Gaming
- Real-time systems
- Financial applications
3. Gateway Load Balancer (GWLB)
GWLB is used for:
- Firewalls
- Intrusion detection systems
- Security appliances
Architecture
Internet Traffic
|
Gateway Load Balancer
|
Security Appliances
|
Application Servers
4. Classic Load Balancer (CLB)
Legacy load balancer supporting:
- Basic HTTP
- TCP traffic
AWS recommends:
ALB or NLB instead of CLB
Elastic Load Balancer and Auto Scaling
ELB integrates tightly with:
Auto Scaling Groups (ASG)
Architecture
Users
|
ELB
|
Auto Scaling Group
|
---------------------
| | |
EC2 EC2 EC2
Benefits
- Automatic traffic balancing
- Automatic scaling
- Self-healing infrastructure
ELB Across Multiple Availability Zones
ELB supports:
Multi-AZ architecture
Architecture
ELB
/ \
AZ-1 AZ-2
/ \ / \
EC2 EC2 EC2 EC2
Benefits
- High availability
- Disaster resilience
- Fault tolerance
SSL Termination
ELB can handle:
HTTPS encryption/decryption
Benefits
- Reduced backend CPU usage
- Simplified certificate management
Sticky Sessions
ELB supports:
Session persistence
Same user requests go to same backend server.
Use Cases
- Legacy session-based applications
ELB Monitoring
ELB integrates with:
- CloudWatch
- CloudTrail
- AWS WAF
Important Metrics
- Request count
- Latency
- Healthy host count
- HTTP 5xx errors
Security Features
- SSL/TLS support
- AWS WAF integration
- DDoS protection using AWS Shield
- Security group integration
Production Best Practices
- Use ALB for web applications
- Enable multi-AZ deployment
- Configure health checks properly
- Use HTTPS everywhere
- Enable access logs
- Monitor CloudWatch metrics
Common Production Problems
- Improper health check configuration
- Backend timeout issues
- SSL certificate expiration
- High latency
- Unhealthy targets
Real-World Production Architecture
Internet Users
|
CloudFront CDN
|
Application Load Balancer
|
Auto Scaling Group
|
Microservices / EC2 / Containers
|
RDS Database
Advantages of ELB
- High availability
- Automatic scaling
- Fault tolerance
- Managed infrastructure
- Improved performance
Disadvantages
- Additional cost
- Configuration complexity
- Latency overhead in some cases
Interview Answer
Elastic Load Balancer (ELB) is an AWS managed service that automatically distributes incoming traffic across multiple backend targets such as EC2 instances, containers, IP addresses, or Lambda functions.
ELB improves:
- Availability
- Scalability
- Fault tolerance
- Application performance
AWS provides multiple ELB types:
- Application Load Balancer (ALB)
- Network Load Balancer (NLB)
- Gateway Load Balancer (GWLB)
- Classic Load Balancer (CLB)
ELB also supports:
- Health checks
- SSL termination
- Auto Scaling integration
- Multi-AZ deployments
Quick Summary Table
| ELB Type | Layer | Main Use Case |
|---|---|---|
| ALB | Layer 7 | Web applications |
| NLB | Layer 4 | High-performance TCP/UDP |
| GWLB | Layer 3/4 | Security appliances |
| CLB | Legacy | Older applications |
Useful Internal Links
- AWS Interview Questions
- Cloud Computing Interview Questions
- DevOps Interview Questions
- Docker Interview Questions
- Kubernetes Interview Questions
Final Conclusion
Elastic Load Balancer (ELB) is a critical AWS networking service used to build:
- Highly available applications
- Scalable cloud architectures
- Fault-tolerant systems
ELB automatically distributes traffic, removes unhealthy instances, integrates with Auto Scaling, and supports modern cloud-native architectures.
Modern production AWS environments heavily rely on:
- ALB for microservices
- NLB for ultra-high performance
- GWLB for security architectures
Understanding ELB deeply is essential for AWS architects, DevOps engineers, cloud engineers, and system administrators.