
← 3 Users load balanced on different Ec2 Instances
Load Balancer = Traffic distributor across multiple servers
Why Use Load Balancer?
1. Distribute Traffic
- Spread load evenly across multiple instances
- No single server gets overloaded
2. Single Access Point
- Users access one DNS name (e.g.,
myapp.com)
- Don't need to remember multiple IPs
3. Handle Failures Automatically
- Detects when instance crashes
- Routes traffic only to healthy instances
- Users don't notice downtime
4. Health Checks
- Continuously monitors instance health
- Checks a specific endpoint (e.g.,
/health)
- Only sends traffic to healthy instances
Instance 1: /health → 200 OK (Gets traffic)
Instance 2: /health → 500 Error (No traffic)
Instance 3: /health → 200 OK (Gets traffic)
5. SSL/TLS Termination
- Load Balancer handles HTTPS encryption/decryption
- EC2 instances receive plain HTTP internally