AWSDOP-C02
On this page
Beginner-friendly overview

ELB (Elastic Load Balancing)

Elastic Load Balancing is AWS's managed load balancer. It sits in front of a group of targets โ€” EC2 instances, containers, IPs, or Lambda functions โ€” and spreads incoming traffic across the healthy ones. If a target fails its health check, the load balancer stops sending it traffic; if you add more targets, they automatically start receiving their share.

Why a Load Balancer

A single server is both a bottleneck and a single point of failure. Put several servers behind a load balancer and you get two things at once:

  • Scalability โ€” traffic is distributed across many targets, and you can add or remove targets without clients noticing.
  • High availability โ€” the load balancer continuously health-checks targets and routes around unhealthy ones, and it spans multiple Availability Zones.

Clients only ever talk to one stable endpoint (the load balancer's DNS name); the fleet behind it can change freely.

The Four Types

AWS has four load balancers, distinguished mainly by which network layer they operate at:

TypeLayerRoutes onUse it for
ALB (Application)7 (HTTP)Path, host, headersWeb apps, microservices, blue/green
NLB (Network)4 (TCP/UDP)PortExtreme performance, static IPs
GWLB (Gateway)3All trafficInline security appliances (firewalls)
CLB (Classic)4/7LegacyOld accounts only โ€” usually the wrong answer

For DOP-C02, the ALB is by far the most important โ€” it's the machinery behind blue/green deployments, canary releases, and Auto Scaling health checks.

One stable endpoint โ†’ listener rules โ†’ target groups โ†’ healthy targets Clients ALB listener + rules path / host match Target group A /api/* ยท health check Target group B /static/* ยท health check EC2 / ECS / IP healthy only EC2 / ECS / IP healthy only

The Piece That Matters Most: Target Groups

Everything plugs into a target group โ€” a set of targets plus a health check. An ALB has one or more listeners (e.g. HTTPS on 443), and each listener has rules that route requests to different target groups based on the URL path or host. Two ideas that flow from this shape:

  • Blue/green = two target groups. You deploy the new version behind a second target group, then flip the listener from the old group to the new one.
  • Auto Scaling attaches to a target group, so scaling out/in automatically registers and deregisters targets.
The load balancer is a stable front door; target groups are the rooms behind it. Clients always knock on the same door (the ELB's DNS name), while the load balancer quietly routes them to healthy targets and drops the ones that fail their health check. Most DOP-C02 load-balancer questions are really about target groups โ€” blue/green swaps, health checks driving Auto Scaling, and connection draining during deploys.