AWS · Networking and Content Delivery

Elastic Load Balancing (ELB)

Managed load balancers that spread traffic across healthy targets: Application (HTTP), Network (TCP/UDP) and Gateway (appliances).

On the SAA-C03 exam listLoad balancing

What it is and what problem it solves

Elastic Load Balancing puts one stable endpoint in front of many targets (EC2 instances, containers, IP addresses, Lambda functions) and sends each request or connection to a healthy one. It runs in several Availability Zones, checks target health, and scales itself with traffic.

There are three current types:

  • Application Load Balancer (ALB) works at layer 7 (HTTP and HTTPS). It routes by path, host name, header or query string, terminates TLS, authenticates users with Cognito or OIDC, and supports WebSockets and gRPC.
  • Network Load Balancer (NLB) works at layer 4 (TCP, UDP, TLS). It handles very high connection rates with low latency, keeps the client's source IP, and gives each zone a static IP address (or an Elastic IP).
  • Gateway Load Balancer (GWLB) sends traffic through fleets of third-party virtual appliances (firewalls, intrusion detection) transparently, using the GENEVE protocol.

The older Classic Load Balancer still exists for legacy setups.

ClientsALB (layer 7)routes by path, host, headerHTTPSAPI target group/api/*Lambda target/images/*Admin servicehost: admin.*
An Application Load Balancer routes each HTTP request by its path, host name or headers

When to use it

  • Any service with more than one server or container, so that one failing target does not take it down.
  • ALB: web applications and APIs, microservices routed by path or host, containers on ECS or EKS, user authentication at the edge of the app.
  • NLB: non-HTTP protocols, millions of requests per second, static IP addresses for allow-lists, PrivateLink services, preserving client IPs.
  • GWLB: inserting a fleet of security appliances into traffic paths without changing routing in every application.

When to avoid it

  • A single-instance development environment: the hourly charge buys nothing without several targets.
  • Global routing across Regions: a load balancer is regional; use Route 53 or Global Accelerator in front.
  • Caching static content near users: that is CloudFront.
  • Serverless HTTP APIs with per-request auth, throttling and usage plans: API Gateway may fit better than an ALB in front of Lambda.

Scaling model and bottlenecks

Load balancers scale automatically, but ALBs scale by adding capacity behind the scenes, so a very sudden jump in traffic can briefly outpace it; for planned events you can reserve capacity in advance. NLBs handle sudden spikes well. Targets scale separately, usually with an Auto Scaling group registered to the target group. Cross-zone load balancing evens out traffic when zones have different numbers of targets.

Performance, latency and throughput

NLB adds the least latency and passes connections through; ALB inspects HTTP, which costs a little latency but enables content-based routing. Keep-alive connections between the load balancer and targets reduce connection setup cost. Deregistration delay (connection draining) lets in-flight requests finish when a target leaves.

Limits and quotas

ItemValueContextSource
Application Load Balancers per Region 50
Can be raised with a quota request
Source
checked
Targets per Application Load Balancer 1,000
Can be raised with a quota request
Source
checked
Rules per Application Load Balancer 100
Can be raised with a quota request
Not counting default rules. Source
checked
Target groups per Region 3,000
Can be raised with a quota request
Shared by Application and Network Load Balancers. Source
checked
Targets per Network Load Balancer 3,000
Can be raised with a quota request
Also 500 per Availability Zone. Source
checked
Listeners per Network Load Balancer 50
Fixed limit
Source
checked
Targets per Gateway Load Balancer 300
Fixed limit
Source
checked

Quotas and limits change. Check the linked source before designing around a number.

Cost model

What you pay for

  • Hours: each load balancer is billed per hour (partial hours count as full).
  • Capacity units: ALB bills LCU-hours, NLB NLCU-hours and GWLB GLCU-hours. A capacity unit is set by whichever dimension is highest in that hour: new connections, active connections, bytes processed, and (for ALB) rule evaluations.
  • Standard data transfer, public IPv4 addresses and the targets themselves are billed separately.

Where it is cost-efficient

One shared ALB with host- and path-based rules serving many small services, instead of one load balancer each.

Where costs grow

  • Many load balancers for tiny services, each paying the hourly charge.
  • Large responses (processed bytes) or many long-lived connections, which raise capacity units.
  • Many complex rules evaluated on every request on an ALB.
  • Cross-zone traffic to targets in other zones, which adds data transfer.

Cost controls and common surprises

Consolidate services onto shared ALBs with rules, remove idle load balancers, compress responses, and check LCU usage in CloudWatch.

Prices differ by Region and change over time; see the pricing page linked under Sources.

Security

Controls the service provides

  • TLS termination with ACM certificates and managed security policies; ALB supports mutual TLS.
  • Security groups on ALBs and NLBs restrict who can connect.
  • AWS WAF integrates with ALB to block common web attacks; Shield Standard protects against common DDoS attacks automatically.
  • ALB can authenticate users (Cognito, OIDC) before requests reach the app.

What you configure

Put the load balancer in public subnets and targets in private subnets, allow targets to accept traffic only from the load balancer's security group, redirect HTTP to HTTPS, and choose a current TLS policy.

Logging and monitoring

Access logs to S3, CloudWatch metrics per load balancer and target group, and CloudTrail for configuration changes.

Related security services

ACM, AWS WAF, Shield, Network Firewall (behind a GWLB), Cognito.

Shared responsibility

AWS runs and scales the load balancer. You choose listeners, certificates, policies, security groups and what your targets do.

Availability, backup and failure behavior

A load balancer runs in every zone you enable and stops sending traffic to targets that fail health checks. Enable at least two zones with targets in each. Combined with an Auto Scaling group, failed instances are replaced automatically. For Regional failure, put Route 53 failover or Global Accelerator in front of load balancers in two Regions.

Common service combinations

EC2 Auto Scaling or ECS/EKS behind an ALB; ACM certificates; WAF on the ALB; Route 53 alias records; CloudFront in front; NLB as a PrivateLink endpoint service; GWLB with Network Firewall or partner appliances.

Business application examples

  • An e-commerce site with /api/* going to one service and everything else to the web front end.
  • A game server fleet using UDP behind an NLB with static IPs.
  • A central inspection VPC where all traffic passes a GWLB-fronted firewall fleet.

Exam cues and common confusions

  • HTTP routing by path or host, microservices, containers: ALB.
  • TCP/UDP, extreme performance, static IP, preserve source IP, PrivateLink: NLB.
  • Third-party appliances inline: GWLB.
  • Sticky sessions are a target-group setting; connection draining is deregistration delay.
  • Unhealthy instances replaced: use ELB health checks in the Auto Scaling group.
  • Global or cross-Region: Route 53 or Global Accelerator, not ELB.

Related

Courses and lessons

Services, comparisons and patterns

Sources

Independent study material, not affiliated with or endorsed by Amazon Web Services. AWS and service names are trademarks of Amazon.com, Inc. or its affiliates.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake