02. AWS ELB
Elastic Load Balancing (ELB) automatically distributes incoming traffic across multiple EC2 instances (targets). It improves elasticity, availability, and fault tolerance.
Load Balancerโ
- Acts as a single entry point (DNS hostname).
- Distributes requests across backend EC2 instances.
- Performs health checks and removes unhealthy targets.
- Supports SSL termination (HTTPS).
- Enables multi-AZ high availability.
๐๏ธ Architectureโ
Request Flow
User โ Load Balancer โ EC2 Instances (Targets)
- Traffic is routed only to healthy instances.
- Instances are spread across multiple AZs.
- Scaling is automatic when used with Auto Scaling Groups.
โฏ๏ธ AWS-Managed vs Self-Managed Load Balancerโ
| Type | Description | Managed By | Maintenance Effort | Cost |
|---|---|---|---|---|
| AWS Managed ELB | Fully managed service | AWS | Low | Moderate |
| Self-Managed LB (on EC2) | Custom setup on EC2 | You | High (OS, patching, scaling) | Lower initially |
๐งฑ OSI Model (7 Layers)โ
- Layer 7 โ Application: HTTP, HTTPS, DNS
- Layer 6 โ Presentation: SSL/TLS, Encryption
- Layer 5 โ Session: Session control
- Layer 4 โ Transport: TCP, UDP
- Layer 3 โ Network: IP, Routing
- Layer 2 โ Data Link: MAC, Ethernet
- Layer 1 โ Physical: Cables, Signals
Mnemonic: All People Seem To Need Data Processing
๐ Types of Load Balancers in AWSโ
AWS provides four load balancer types:
| Load Balancer | Layer | Protocols | Key Features | Use Case |
|---|---|---|---|---|
| Application Load Balancer (ALB) | Layer 7 | HTTP, HTTPS, gRPC | Path/host-based routing | Web apps, APIs |
| Network Load Balancer (NLB) | Layer 4 | TCP, UDP | Ultra-high performance, static IP | Gaming, IoT, real-time apps |
| Gateway Load Balancer (GWLB) | Layer 3 | IP (GENEVE) | Traffic inspection & firewalling | Security appliances |
| Classic Load Balancer (CLB) (deprecated) | Layer 4 & 7 | TCP, HTTP | Legacy | โ |
01. Application Load Balancer (ALB)โ
- Operates at Layer 7 (HTTP/HTTPS).
- Supports advanced routing (host, path, headers, query).
- Static DNS
- Uses target groups.
- Supports WebSockets and gRPC.
- Provides a static DNS name (not static IP).
๐งฉ Architecture (ALB)โ

๐ ๏ธ Use Casesโ
- Web applications
- REST APIs
- Microservices (ECS, EKS)
02. Network Load Balancer (NLB)โ
- Operates at Layer 4 (TCP/UDP).
- Handles millions of requests per second.
- Supports static IPs using Elastic IPs.
- Optimized for low latency.
๐งฉ Architecture (NLB)โ

๐ ๏ธ Use Casesโ
- Real-time systems
- Gaming backends
- Financial or IoT workloads
03. Gateway Load Balancer (GWLB)โ
- Operates at Layer 3 (IP).
- Uses GENEVE (UDP port 6081).
- Routes traffic through security appliances/firewall on EC2.
- Enables centralized traffic inspection, intrusion detection or deep packet inspeciton.
๐งฉ Architecture (GWLB)โ

๐ ๏ธ Use Casesโ
- Firewalls
- IDS / IPS systems
- Deep packet inspection
04. Classic Load Balancer (CLB)โ
โ ๏ธ Deprecated (do not use for new workloads)
- Supports Layer 4 & 7.
- Superseded by ALB and NLB.
- Appears only in legacy architectures.
๐งฉ Comparison Summaryโ
| Feature | ALB | NLB | GWLB |
|---|---|---|---|
| Layer | 7 | 4 | 3 |
| Protocol | HTTP/HTTPS/gRPC | TCP/UDP | IP (GENEVE) |
| Routing Logic | Advanced | Connection-based | Packet forwarding |
| Static IP | โ | โ | โ |
| SSL Termination | โ | โ | โ |
| Health Checks | HTTP | TCP | IP-based |
๐งพ Exam Tips (CLF-C02)โ
| Scenario | Choose |
|---|---|
| HTTP / HTTPS routing | ALB |
| Millions of requests, ultra-low latency | NLB |
| Firewall or packet inspection | GWLB |
| Static IP required | NLB |
| Legacy architecture | CLB |