- Imagine a busy office building with many departments. A receptionist directs visitors so no single department becomes overwhelmed.
- Mapping:
- The building = your EC2 compute/backend infrastructure.
- Visitors = incoming client requests or traffic.
- Receptionist = the load balancer that routes traffic to the right backend.
- Distributes incoming traffic so no single server becomes overloaded.
- Routes traffic to EC2 instances, ECS tasks, EKS workloads, Lambda functions, API Gateway, and other addressable endpoints.
- Provides a single entry point (one DNS name) for your application; commonly used to terminate TLS at the edge.
- Performs health checks and stops routing traffic to unhealthy targets. Your health endpoint should verify any critical downstream dependencies (databases, caches, external APIs) so the load balancer can detect service-level failures.
- Application Load Balancer (ALB): Layer 7, supports HTTP/HTTPS, host- and path-based routing, WebSockets. Ideal for microservices, containerized apps, and content-aware routing.
- Network Load Balancer (NLB): Layer 4, supports TCP/UDP, preserves source IP, extremely low latency/high throughput, and can provide static IPs.
- Gateway Load Balancer (GWLB): Designed to deploy and scale third-party virtual appliances (firewalls, IDS/IPS) transparently.
- Classic Load Balancer (CLB): Legacy option; still available but largely superseded by ALB and NLB.
Load balancers are a managed AWS service. They appear to you as a single endpoint but operate across multiple devices and Availability Zones for high availability and fault tolerance.

- ALBs and NLBs span multiple Availability Zones to distribute traffic and increase resiliency.
- Cross-zone load balancing spreads traffic across targets in all AZs. ALBs have cross-zone load balancing enabled by default.
- ALBs allocate Elastic Network Interfaces (ENIs) in each configured AZ. ENIs act as the entry point into each AZ for the ALB’s traffic. See AWS docs on ENIs for details.
- Best practice: run targets across multiple AZs so the load balancer has healthy capacity in each AZ to route to.
- Target groups are the routing unit for ALB listeners and rules. A target group is a collection of targets: EC2 instances, IP addresses, Lambda functions, or ECS tasks.
- Use separate target groups to implement host-based or path-based routing (for example,
api.example.comvsapp.example.com/cart). - ALB and NLB both support registering targets by IP address. This enables routing to endpoints in peered VPCs or on-premises over VPN/Direct Connect (subject to routing and security constraints).
- Kubernetes integrations on AWS commonly provision an ALB or NLB as the ingress for services — ALB for HTTP-based ingress and NLB for TCP/UDP workloads.
- A listener is a process on a load balancer that checks for incoming connections on a given port and protocol (for example, HTTPS on 443).
- ALB listeners can have rules to route requests to different target groups based on conditions: host header, path, HTTP header, query string, or source IP.
- Use path- or host-based routing to separate concerns within your application (different microservices, static sites vs API endpoints, etc.).
Design health checks to validate the whole request path: the app process plus critical dependencies (databases, caches, downstream APIs). This prevents routing traffic to instances that appear “up” but are functionally broken.
- Load balancers perform regular health checks and only route traffic to targets that pass.
- Configure health check paths and thresholds appropriate to your app: set an endpoint that performs quick but meaningful checks.
- Health checks should be faster than your client timeouts and consider retries/grace periods for rolling deployments.
- ALB is ideal when you need advanced HTTP routing into containerized or traditional web apps. It’s simple, performant, and integrates tightly with ECS/EKS.
- API Gateway is optimized for API management: request transformation, throttling, authentication/authorization (authorizers), usage plans, caching, and API lifecycle features.
- Choose ALB for routing and low-latency HTTP traffic into services. Choose API Gateway when you need API governance and management features.
- Use Elastic Load Balancing as a single, scalable, highly available entry point to offload TLS termination and manage health checks.
- Combine load balancers with EC2 Auto Scaling Groups so instances are added or removed automatically based on demand and health.
- Always distribute targets across multiple Availability Zones, tune health checks, and apply routing rules aligned with your application topology.
- Monitor load balancer metrics (request count, latency, target health, error rates) and set alarms to detect abnormal behavior early.
Classic Load Balancer (CLB) is legacy. For new architectures prefer ALB (HTTP routing) or NLB (high-throughput TCP/UDP). Plan migrations away from CLB where feasible.
- Elastic Load Balancing — ALB overview: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html
- Elastic Load Balancing — NLB overview: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html
- Elastic Load Balancing — Gateway Load Balancer: https://docs.aws.amazon.com/elasticloadbalancing/latest/gwlb/what-is-gwlb.html
- ENIs (Elastic Network Interfaces): https://docs.aws.amazon.com/vpc/latest/userguide/using-eni.html
- API Gateway overview: https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html
- EC2 Auto Scaling: https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html
