ALB and Container Integration
What you'll learn: How Application Load Balancers route traffic to containerized applications using dynamic port mapping.
When you run containerized applications (like Docker containers), they often don't use fixed ports. A container orchestrator like Amazon ECS or Kubernetes might launch the same application on port 32768 today and port 32771 tomorrow—these are called dynamic ports.
How ALB Handles Dynamic Ports
Traditional load balancers struggle with this because they need to know exactly which port to send traffic to. ALB solves this by integrating directly with container platforms:
- Container registers itself: When a new container starts, the orchestrator tells the ALB's target group, "Hey, there's a new instance of this app running on port 32768"
- ALB updates automatically: The ALB immediately starts routing traffic to that dynamic port
- Health checks adapt: ALB performs health checks on whatever port the container is actually using
- Deregistration on shutdown: When the container stops, it's automatically removed from the target group
The Power of This Integration
Think of it like a restaurant host who automatically updates their seating chart in real-time. As tables (containers) become available or occupied, the host (ALB) always knows exactly where to seat customers (route requests)—without manual updates.
This is especially powerful in target groups, where you can have multiple containers from the same service running on different ports on the same host, and ALB routes to all of them intelligently.
Key Takeaway: ALB's container integration with dynamic port mapping lets you run multiple containerized services on the same infrastructure without port conflicts, automatically routing traffic as containers scale up and down.