Skip to main content

Elastic Load Balancing

Distributing traffic across targets: Application Load Balancers (layer 7 rules, authentication, Lambda targets), Network Load Balancers (layer 4, static IPs, TCP, UDP, TLS, QUIC), Gateway Load Balancers (appliances with GENEVE), Classic Load Balancers, health checks, cross-zone load balancing, stickiness, TLS certificates, security, cost, and monitoring.

7 min read · Last reviewed · SAA-C03

Loading your progress

Sign in to bookmark tutorials and track what you have read.

On this page

What it is

Elastic Load Balancing (ELB) automatically distributes incoming traffic across multiple targets, such as EC2 instances, containers, IP (Internet Protocol)The protocol that addresses and routes packets between networks. Each device has an IP address: IPv4 addresses look like 192.0.2.1, and IPv6 addresses are longer, like 2001:db8::1.Glossary entry addresses, and Lambda functions, in one or more AZ (Availability Zone)An isolated location within an AWS Region, made up of one or more data centers with their own power, cooling, and networking. The AZs in a Region are linked by fast, low-latency connections, so spreading resources across them protects against the failure of one site.Glossary entry. It monitors the health of registered targets and sends traffic only to healthy ones, and it scales automatically with traffic.

Choose a load balancer whenever an application runs on more than one target: for HA (High availability)The ability of a system to keep serving users when parts of it fail, usually by running redundant copies across Availability Zones and failing over automatically. It is often stated as a percentage of uptime, such as 99.99%.Glossary entry across Availability Zones, for scaling with Auto Scaling groups or ECS services, and as the single public entry point for private instances.

Types of load balancers

Application Load Balancer (ALB) Network Load Balancer (NLB) Gateway Load Balancer (GWLB)
OSI layer 7 (HTTP (Hypertext Transfer Protocol)The protocol that web browsers and APIs use to send requests, such as GET and POST, and receive responses. On its own it is not encrypted; HTTPS adds TLS.Glossary entry, HTTPS (HTTP Secure)HTTP sent over a TLS-encrypted connection, so that requests and responses cannot be read or changed on the way, and the server proves its identity with a certificate.Glossary entry, gRPC) 4 (TCP (Transmission Control Protocol)The transport protocol that delivers data reliably and in order: it sets up a connection first and resends lost packets. HTTP, SSH, and most database connections run over TCP.Glossary entry, UDP (User Datagram Protocol)A transport protocol that sends packets without setting up a connection or resending lost ones, trading reliability for low latency. DNS, video calls, and games often use it; Network Load Balancer and AWS Global Accelerator support UDP.Glossary entry, TLS (Transport Layer Security)The protocol that encrypts traffic between a client and a server and lets the server prove its identity with a certificate. It replaced SSL, though the older name is still common; HTTPS is HTTP over TLS.Glossary entry, QUIC) 3 (all IP packets)
Routes by Content: host, path, HTTP headers, method, query string, source IP Protocol and port, at millions of requests per second Sends traffic through virtual appliances
Targets Instances, IPs, Lambda functions, containers Instances, IPs, ALBs Appliance instances or IPs
Stand-out features Redirects, fixed responses, user authentication (Cognito or OIDC (OpenID Connect)A sign-in standard built on OAuth 2.0 that lets an application learn who a user is from a trusted identity provider, through a signed ID token. IAM accepts OIDC providers, so that, for example, a GitHub Actions workflow can assume an IAM role.Glossary entry), WAF Static IPs (one per Availability Zone, can be Elastic IPs), preserves client IP, ultra-low LatencyThe time between sending a request and receiving the response, usually measured in milliseconds. Distance and processing add to it; caching and serving users from nearby locations reduce it.Glossary entry GENEVE on port 6081, flow stickiness, transparent "bump in the wire"
Choose for Web apps, MicroservicesAn application built as small, independent services, each owning one business function and its data, that communicate over APIs or events. Each service can be changed, deployed, and scaled on its own.Glossary entry, containers Extreme performance, non-HTTP protocols, fixed IPs, PrivateLink services Third-party firewalls, IDS (Intrusion detection system)A system that watches network traffic or servers for signs of attack or misuse and raises alerts. It detects; an intrusion prevention system (IPS) also blocks.Glossary entry/IPS (Intrusion prevention system)A system that inspects traffic for attacks and blocks matching traffic automatically, rather than only raising alerts. AWS Network Firewall can act as an IPS with Suricata-compatible rules.Glossary entry, deep packet inspection

Classic Load Balancers are the previous generation; AWS recommends migrating to a current-generation load balancer.

Concepts

  • Listener: a protocol and port that the load balancer listens on, such as HTTPS 443.
  • Rules (ALB): conditions and actions evaluated in priority order:
    • Conditions: host-header, path-pattern, http-header, query-string, source-ip, and more.
    • Actions: forward (to target groups, optionally weighted), redirect (such as HTTP to HTTPS), fixed-response, and authenticate-cognito or authenticate-oidc on HTTPS listeners.
  • Target group: a set of targets and their Health checkA regular test, such as a request to a web page, that a load balancer, an Auto Scaling group, or Route 53 makes to see whether a resource is working. Unhealthy resources stop receiving traffic or are replaced.Glossary entry settings. With the IP target type, targets can be private IP addresses outside the VPC, such as servers in a peered VPC or On-premisesIn data centers or offices that you run yourself, rather than in the cloud. Hybrid architectures connect on-premises systems to AWS, for example through AWS Direct Connect or a VPN.Glossary entry over Direct Connect or Site-to-Site VPN (Virtual private network)An encrypted tunnel over a public network, such as the internet, that joins networks or devices as if they were directly connected. AWS Site-to-Site VPN connects networks; AWS Client VPN connects individual users.Glossary entry, so one load balancer can spread traffic across EC2 and on-premises servers during a migration. Settings include the routing algorithm (round robin by default, or least outstanding requests), deregistration delay (connection draining), slow start, and Sticky sessionsA load balancer setting that sends a client's requests to the same target for a period, tracked with a cookie. It suits applications that keep session data on the server, but it can spread load unevenly.Glossary entry.
  • Cross-zone load balancing:
    • ALB: always on at the load balancer level; it can be turned off per target group.
    • NLB and GWLB: off by default; you can turn it on.
    • With cross-zone on, every node spreads traffic across targets in all enabled Availability Zones.
  • Client IP: ALBs add X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Port headers, so backends can see the original client.
  • Internet-facing or internal: internet-facing load balancers sit in SubnetA range of IP addresses in a VPC, inside one Availability Zone. A subnet is public when its route table sends internet traffic to an internet gateway, and private when it does not.Glossary entry; internal ones have only private IPs.
Path-based routing on an Application Load Balancer. Users connect over HTTPS to the load balancer's listener on port 443. A rule sends requests for /api/* to a target group of two EC2 API servers, and another sends requests for /images/* to a target group with a container that serves images.

Security, resilience, performance, and cost

Security

  • Terminate TLS on the load balancer with certificates from AWS Certificate Manager (or IAM), and choose a security policy for TLS versions. One HTTPS listener can hold several certificates, and the load balancer picks the right one for each domain with SNI, so one ALB can serve many HTTPS domains (route them with host-header rules).
  • Mutual TLS on an ALB checks client certificates in one of two modes: verify, where the load balancer validates them against a trust store, or passthrough, where it forwards the client's certificate chain in the X-Amzn-Mtls-Clientcert header for the application to validate.
  • Attach Security groupA stateful virtual firewall for network interfaces, such as an EC2 instance's, whose rules can only allow traffic. Return traffic for allowed connections is allowed automatically, and a rule can refer to another security group instead of IP addresses.Glossary entry to ALBs, and optionally to NLBs. An NLB can use security groups only if it was created with at least one; you can't add them later to an NLB created without them. Once it has them, you can change them at any time. Let targets accept traffic only from the load balancer's security group.
  • Protect ALBs with AWS WAF, and authenticate users at the ALB with Cognito or an OIDC identity provider.

Resilience

  • Enable at least two Availability Zones, with healthy targets in each. Health checks take failed targets out of rotation.
  • An Auto Scaling group uses only EC2 status checks by default, so an instance whose application hangs keeps running. Turn on Elastic Load Balancing health checks for the group so it also replaces instances that fail the load balancer's health checks.
  • Zonal shift moves traffic away from an impaired Availability Zone.

Performance

  • ALB scales automatically; LCU reservations pre-provision capacity for known traffic spikes. NLB handles millions of requests per second with very low latency.

Cost

  • Pay for each hour the load balancer runs, plus Load Balancer Capacity Units (LCUs) (or NLCUs and GLCUs) for the traffic it handles.

Monitoring

  • CloudWatch metrics such as request count, latency, HTTP error codes, and healthy host count.
  • Access logs are delivered to S3.

Which load balancer?

If the requirement is Choose
Route by URL path or host name to different services Application Load Balancer
Authenticate users before they reach the app ALB with Cognito or OIDC
Invoke Lambda functions over HTTP ALB with Lambda targets
TCP or UDP at millions of requests per second Network Load Balancer
Static or Elastic IP addresses for allow lists Network Load Balancer
Expose a service through PrivateLink Network Load Balancer
Insert third-party firewalls transparently Gateway Load Balancer
Global static IPs and Regional FailoverSwitching automatically to a standby resource when the primary one fails, such as a standby database in Amazon RDS or a backup site chosen by Route 53 failover routing.Glossary entry AWS Global Accelerator in front of ALBs or NLBs
Many HTTPS domains on one load balancer ALB HTTPS listener with several certificates (SNI)
Balance across EC2 and on-premises servers Target group with the IP target type

Reverse mindmap: when the question points here

Which Elastic Load Balancer?
  • Application Load Balancer
    • Path-based or host-based routing leads to ALB listener rules
    • Redirect HTTP to HTTPS leads to ALB redirect action
    • Sign users in at the load balancer leads to ALB with Cognito or OIDC
    • Lambda behind a load balancer leads to ALB Lambda target
    • Client IP at the backend leads to X-Forwarded-For header
    • Several HTTPS domains, one ALB leads to Certificate list with SNI
    • App validates client certificates itself leads to mTLS passthrough
  • Network Load Balancer
    • Extreme performance, TCP or UDP leads to NLB
    • Fixed IP per Availability Zone leads to NLB with Elastic IPs
    • Endpoint service for PrivateLink leads to NLB
  • Gateway Load Balancer
    • Firewalls or IDS appliances inline leads to GWLB with GWLB endpoints
  • Behaviors
    • Keep users on the same target leads to Sticky sessions
    • Finish requests before removing a target leads to Deregistration delay
    • Uneven Availability Zones on NLB leads to Turn on cross-zone
    • Only accept traffic from the ALB leads to Target security group references the ALB's group
    • Replace instances the load balancer marks unhealthy leads to ELB health checks on the Auto Scaling group
    • On-premises servers as targets leads to IP target type

Key takeaways

  • ELB spreads traffic across healthy targets in multiple Availability Zones and scales automatically.
  • ALB is layer 7, with content-based rules, redirects, authentication, Lambda targets, and WAF.
  • NLB is layer 4 (TCP, UDP, TLS, QUIC), with static or Elastic IPs and very high performance; it's the front end for PrivateLink services.
  • GWLB is layer 3, inserting appliances using GENEVE on port 6081.
  • Cross-zone load balancing is always on for ALB (adjustable per target group) and off by default for NLB and GWLB.
  • Terminate TLS with ACM certificates; restrict targets to the load balancer's security group.
  • Turn on ELB health checks for Auto Scaling groups, or the group won't replace instances that fail only the load balancer's checks.

Sources

Check your understanding

Loading your quiz progress

Sign in to check your understanding with 27 questions on Elastic Load Balancing.

Glossary Install the app

LetMeMaster is an independent educational project and is not affiliated with or endorsed by Amazon Web Services. Practice results do not predict actual exam outcomes.

© 2026 LetMeMaster. All rights reserved. Content may not be copied or redistributed without permission.

Proudly made in Canada

Add LetMeMaster to your Home Screen

  1. Tap the Share button in your browser's toolbar. In Safari it is at the bottom of the screen, or at the top on iPad.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. Open LetMeMaster from its icon on your Home Screen.