Skip to main content
Welcome — this article gives a focused, practical overview of AWS EC2 auto scaling and Elastic Load Balancing (ELB). These core services let you build highly available, fault-tolerant, and scalable VM-based architectures. After the conceptual overview we cover key components (ALB/NLB/GWLB), cross-AZ behavior, ENIs, target groups, listeners, health checks, and when to pair ALB with API Gateway. Overview analogy
  • 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.
What a load balancer does
  • 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.
Types of Elastic Load Balancers
  • 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.
Diagram titled "ELB With Multi-AZ" showing clients sending traffic to an Elastic Load Balancer which distributes requests to EC2 instances across three availability zones (AZ1, AZ2, AZ3) for high availability, fault tolerance, and scalability.
Cross-zone load balancing, ALBs, and ENIs
  • 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 and registered targets
  • 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.com vs app.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.
Listeners and routing rules
  • 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.
Health checks
  • 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.
When to use ALB vs API Gateway
  • 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.
Final notes and best practices
  • 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.
Links and references
A diagram of a load balancer listener routing requests for app1.com, app2.com/auth, and app2.com/cart to three separate target groups. Each target group is shown backed by different AWS resources (EC2/ECS icons and Lambda icons).

Watch Video