AWS Application Load Balancer (ALB) Overview
- Layer 7 Load Balancer: ALB operates at the application layer, handling HTTP/HTTPS traffic.
- Target Groups: Routes traffic to groups of resources, such as EC2 instances, ECS tasks, Lambda functions, or private IP addresses.
- Container and Microservices Support: Ideal for container-based applications using ECS due to port mapping features for dynamic ports.
- Advanced Routing: Capable of routing based on URL path, hostname, query strings, and headers.
- HTTP/2 and WebSocket Support: ALB supports modern web protocols for efficient communication.
- Automatic Redirects: Can automatically redirect HTTP traffic to HTTPS for secure communication.
- Health Checks: Performs health checks at the target group level to ensure traffic is only routed to healthy targets.
- Serverless Integration: Can route traffic to AWS Lambda functions for serverless architectures.
- Fixed Hostname: Provides a consistent DNS name for the load balancer.
- Client IP Preservation: Uses
X-Forwarded-For, X-Forwarded-Ports, and X-Forwarded-Proto headers to pass the original client IP and protocol information to the backend.

Example Scenario
- Public Facing ALB: Serves as the entry point for incoming web traffic.
- Multiple Target Groups:
/user path routes to a target group with EC2 instances for user-related services.
/search path routes to a different target group with EC2 instances for search services.
- Routing Rules: ALB uses rules to direct traffic to the appropriate target group based on the request path, hostname, or query parameters.
- Use Case for Query String Routing:
- Mobile traffic with
?Platform=Mobile in the URL is routed to one target group.
- Desktop traffic with
?Platform=Desktop is routed to another target group.
Preparing for Hands-On
- Fixed Hostname: ALB provides a stable DNS name.
- Client IP Headers: The backend servers access the client's IP through specific HTTP headers due to the load balancer's connection termination.