Elastic Load Balancing

Also known as: ELB · AWS Elastic Load Balancing

On this page 7

Elastic Load Balancing (ELB) is the managed load balancing service of Amazon Web Services that automatically distributes incoming application or network traffic across multiple targets, such as EC2 instances, containers, IP addresses and Lambda functions, in one or more Availability Zones. In cloud networking, it sits at the entry point of a workload inside a VPC and turns a group of interchangeable servers into one stable, highly available endpoint.

The word elastic describes the service itself: AWS scales the load balancer capacity automatically as traffic grows or falls, so operators do not size, patch or replace load balancer appliances. ELB is the AWS-specific implementation of the broader cloud load balancer concept and works closely with security groups, Amazon Route 53, autoscaling groups and AWS Global Accelerator.

How Elastic Load Balancing routes traffic

Elastic Load Balancing works by placing load balancer nodes in each enabled Availability Zone and resolving one DNS name to the addresses of those nodes. A client connects to a node, and the node forwards the request to a registered target selected by the routing algorithm and the current health status of each target.

Every load balancer has three building blocks. Listeners check for connections on a protocol and port, such as HTTPS on 443. Rules attached to a listener decide where a request goes. Target groups hold the registered backends together with their health check settings, so one load balancer can serve many applications by sending each rule to a different target group.

Health checks are the mechanism that delivers availability. The load balancer probes each target at a fixed interval, and a target that fails a set number of consecutive checks is marked unhealthy and removed from rotation until it recovers. When cross-zone load balancing is enabled, each node spreads traffic across targets in all zones rather than only its own zone, which evens out load when zones hold different numbers of targets.

The following table lists the core components and their role in a request path.

ComponentWhat it definesTypical example
ListenerProtocol and port that accept client connectionsHTTPS on port 443
RuleCondition and action for routing a requestPath /api/* goes to the API group
Target groupSet of backends plus health check settingsSix containers on port 8080
Health checkProbe path, interval and thresholdsGET /health every 10 s
NodePer-zone capacity that receives trafficOne node per enabled zone
Core components of an Elastic Load Balancing setup

Types of Elastic Load Balancing

Elastic Load Balancing offers four load balancer types, each operating at a different layer of the network stack. The choice determines which routing decisions are possible, how much latency is added and which features, such as TLS termination or static IP addresses, are available.

The Application Load Balancer works at Layer 7 and reads HTTP headers, paths, host names and query strings. The Network Load Balancer works at Layer 4, handles TCP, UDP and TLS with very low latency and can expose one static or Elastic IP address per zone. The Gateway Load Balancer inserts third-party firewalls and inspection appliances transparently by using the GENEVE encapsulation protocol on port 6081. The Classic Load Balancer is the previous generation and is kept only for legacy workloads.

TypeOSI layerProtocolsBest suited for
Application Load BalancerLayer 7HTTP, HTTPS, gRPC, WebSocketWeb applications and microservices
Network Load BalancerLayer 4TCP, UDP, TLSLow-latency or non-HTTP traffic
Gateway Load BalancerLayer 3IP packets over GENEVEFirewall and inspection fleets
Classic Load BalancerLayer 4 and 7TCP, SSL, HTTP, HTTPSLegacy EC2-Classic era setups
Comparison of the four load balancer types

Key configuration parameters

A handful of settings decide how Elastic Load Balancing behaves under failure and during deployments. Defaults are reasonable for many workloads, but tuning health checks and draining usually has the largest effect on user-visible errors.

The table below summarizes the parameters that operators adjust most often, with common values and what each one affects.

ParameterCommon rangeEffect
Health check interval5 to 300 s, often 10 to 30 sSpeed of detecting a failed target
Unhealthy threshold2 to 10 failed checksBalance between fast removal and flapping
Deregistration delay0 to 3,600 s, default 300 sTime for in-flight requests to finish
Idle timeout1 to 4,000 s, default 60 sHow long idle connections stay open
Stickiness duration1 s to 7 daysHow long a client stays on one target
Frequently tuned ELB parameters

Connection draining, called the deregistration delay in current load balancers, lets a target finish open requests before it leaves the group. A delay that is too long slows rolling deployments, while a delay that is too short cuts off uploads and long API calls. Session stickiness keeps a client on one target with a cookie, but it weakens even distribution and should be a temporary measure for stateful legacy code.

Elastic Load Balancing distributes traffic within one AWS Region, which separates it from services that steer traffic globally or simply translate names. Teams often combine several of them in one architecture, so the boundaries matter.

ServiceScopeMain jobRelationship to ELB
Elastic Load BalancingRegionalSpread traffic across healthy targetsBaseline entry point
Amazon Route 53Global DNSResolve names, failover between RegionsPoints alias records at load balancers
AWS Global AcceleratorGlobal edgeAnycast static IPs over the AWS backboneUses load balancers as endpoints
Amazon CloudFrontGlobal edgeCache and deliver contentUses a load balancer as origin
How ELB relates to neighboring networking services

A multi-Region design therefore typically uses Route 53 or Global Accelerator in front of one load balancer per Region. ELB itself never moves traffic between Regions, and a regional outage cannot be absorbed by a single load balancer, however many zones it spans.

Limitations and common mistakes

Elastic Load Balancing removes much operational work, yet several recurring misconfigurations cause outages, unexpected cost or security gaps. Most of them come from treating the load balancer as a black box.

  • Shallow health checks that only test whether a port is open keep sending traffic to targets whose database connection has failed.
  • Deep health checks that call shared dependencies can mark every target unhealthy at once; when all targets fail, the load balancer fails open and sends traffic to all of them anyway.
  • Overly permissive security groups on targets allow traffic that bypasses the load balancer; targets should accept traffic only from the load balancer security group.
  • Hard-coding load balancer IP addresses breaks clients, because Application Load Balancer addresses change; use the DNS name or a Network Load Balancer with static addresses.
  • Ignoring cost drivers such as Load Balancer Capacity Units and cross-zone data transfer leads to surprising bills for idle or chatty workloads.

Sudden traffic spikes deserve special care. Capacity scales automatically, but scaling is not instantaneous, so events with an abrupt surge, such as a product launch, may need load testing in advance or a pre-warming request through AWS support.

The idea in brief

Picture a busy supermarket with ten checkout lanes and one staff member at the entrance who points each shopper to the shortest open lane. If a register breaks, that person stops sending people there. Elastic Load Balancing plays that role for a website or application running on AWS.

Visitors always use one address, while the service quietly spreads their requests across many servers and skips any server that stops responding. When more visitors arrive, the service grows by itself. The result is an application that stays online when individual servers fail.

A practical scenario

An online ticketing platform runs its checkout API on twelve containers spread across three Availability Zones in one AWS Region. An Application Load Balancer terminates HTTPS with a certificate from AWS Certificate Manager and sends requests under /checkout to one target group and /search to another, each with its own health check on a /health path every 10 seconds.

During a rolling deployment, the team sets the deregistration delay to 60 seconds so that payments in progress finish before old containers stop. When one zone suffers a network fault during a concert sale, health checks remove its four containers within about 30 seconds, and the remaining eight absorb the load while autoscaling adds replacements. The outcome is no failed checkout requests visible to buyers and a deployment window shortened from five minutes to roughly one.