Task Statement 3.3: Optimize AWS networks for performance, reliability, and cost-effectiveness.
📘AWS Certified Advanced Networking – Specialty
1. What is Load Balancing?
Load balancing is the process of distributing incoming network traffic across multiple resources (such as servers, containers, or applications).
Why it is important
- Prevents overload on a single server
- Improves performance and response time
- Ensures high availability
- Provides fault tolerance (if one fails, others continue)
2. AWS Load Balancing Services
AWS mainly provides Elastic Load Balancing (ELB), which includes:
1. Application Load Balancer (ALB)
- Works at Layer 7 (HTTP/HTTPS)
- Supports:
- Path-based routing (
/api,/images) - Host-based routing (
app.example.com)
- Path-based routing (
- Best for:
- Web applications
- Microservices architectures
2. Network Load Balancer (NLB)
- Works at Layer 4 (TCP/UDP)
- Very high performance and low latency
- Can handle millions of requests per second
- Best for:
- Real-time systems
- Gaming, IoT, financial systems
3. Gateway Load Balancer (GWLB)
- Used for security appliances
- Distributes traffic to:
- Firewalls
- Intrusion detection systems
- Works with third-party virtual appliances
4. Classic Load Balancer (CLB)
- Older generation
- Supports basic Layer 4 and Layer 7
- Not recommended for new architectures
3. Core Load Balancing Concepts
1. Target Groups
- A group of resources (EC2, IPs, Lambda)
- Load balancer sends traffic to targets inside the group
2. Health Checks
- Load balancer checks if targets are healthy
- If unhealthy → traffic is stopped
3. Listeners
- Defines:
- Protocol (HTTP, HTTPS, TCP)
- Port (80, 443)
- Routes requests based on rules
4. Cross-Zone Load Balancing
- Distributes traffic evenly across multiple Availability Zones
- Improves reliability
4. Traffic Distribution Algorithms
Load balancers decide how traffic is distributed using algorithms.
1. Round Robin
- Requests are distributed sequentially:
- Server 1 → Server 2 → Server 3 → repeat
Characteristics:
- Simple
- Equal distribution
- Does NOT consider server load
2. Least Outstanding Requests
- Sends traffic to server with fewest active connections
Characteristics:
- Better for uneven workloads
- Improves performance under heavy load
3. Flow Hash (NLB)
- Uses:
- Source IP
- Destination IP
- Port
- Ensures same client goes to same target
Used for:
- Session consistency
5. Traffic Distribution Patterns (VERY IMPORTANT FOR EXAM)
1. DNS-Based Load Balancing (Route 53)
Using Amazon Route 53 routing policies:
Types:
a. Simple Routing
- Single resource
- No health check
b. Weighted Routing
- Distribute traffic based on percentage
- Example:
- Server A → 70%
- Server B → 30%
c. Latency-Based Routing
- Sends users to lowest latency region
d. Failover Routing
- Primary + secondary setup
- Automatically switches if primary fails
e. Geolocation Routing
- Routes based on user location
f. Geoproximity Routing
- Routes based on distance from resources
2. Layer 4 vs Layer 7 Distribution
| Feature | Layer 4 (NLB) | Layer 7 (ALB) |
|---|---|---|
| Decision Based On | IP & Port | URL, Headers |
| Speed | Very fast | Slightly slower |
| Flexibility | Low | High |
3. Path-Based Routing (ALB)
- Routes traffic based on URL path:
/api→ API servers/images→ image servers
4. Host-Based Routing (ALB)
- Routes based on domain:
api.example.com→ APIapp.example.com→ frontend
5. Anycast Routing
- Used by AWS global services
- Same IP address in multiple locations
- Traffic goes to nearest endpoint
6. Traffic Shifting (Deployment Pattern)
Used in application updates
a. Blue/Green Deployment
- Two environments:
- Blue (current)
- Green (new)
- Switch traffic when ready
b. Canary Deployment
- Send small % to new version
- Gradually increase
c. Linear Deployment
- Traffic shifts gradually over time
7. Sticky Sessions (Session Affinity)
- Ensures user connects to same server
- Useful for:
- Applications storing session locally
Types:
- Duration-based cookies
- Application-based cookies
8. Load Balancing Across Regions
Multi-Region Architecture
- Use:
- Route 53 + health checks
- Benefits:
- Disaster recovery
- Reduced latency
9. Integration with Auto Scaling
- Load balancer works with:
- Auto Scaling Groups (ASG)
Behavior:
- New instances → automatically added
- Failed instances → removed
10. Cost Optimization
Strategies:
- Use ALB instead of multiple small servers
- Use NLB for high-throughput workloads
- Use Route 53 routing instead of extra infrastructure
- Enable cross-zone only when needed
- Avoid idle load balancers
11. Security Considerations
- Use HTTPS (SSL/TLS termination)
- Integrate with:
- AWS WAF (Web Application Firewall)
- Security Groups control traffic
12. Monitoring and Troubleshooting
Use:
- Amazon CloudWatch
- Metrics:
- Request count
- Latency
- Error rates
- Metrics:
- Access Logs
- Health check logs
13. Common Exam Scenarios
Scenario 1
Requirement: Route traffic based on URL path
✅ Use: ALB (Path-based routing)
Scenario 2
Requirement: Ultra-low latency, millions of requests
✅ Use: NLB
Scenario 3
Requirement: Gradually release new version
✅ Use: Weighted routing / Canary deployment
Scenario 4
Requirement: Failover to backup region
✅ Use: Route 53 Failover routing
Scenario 5
Requirement: Maintain session state
✅ Use: Sticky sessions
Scenario 6
Requirement: Send users to nearest region
✅ Use: Latency-based routing
14. Key Exam Tips (VERY IMPORTANT)
- ALB = Layer 7 = Smart routing
- NLB = Layer 4 = High performance
- Route 53 = DNS-level traffic control
- Health checks = automatic failover
- Weighted routing = traffic shifting
- Sticky sessions = session persistence
- Cross-zone = better distribution but may cost more
Final Summary
Load balancing in AWS ensures:
- Traffic is evenly distributed
- Applications stay available and scalable
- Failures are handled automatically
Traffic distribution patterns allow:
- Smart routing (ALB)
- Global routing (Route 53)
- Controlled deployments (Canary, Blue/Green)
