Listener
Listeners
A listener accepts connections on a protocol and port and passes them to target groups according to its rules. A GWLB has exactly one listener, with no protocol or port.
Elastic Load Balancing · ALB · NLB · GWLB
Elastic Load Balancing distributes incoming traffic across healthy targets in multiple Availability Zones. Application Load Balancer handles HTTP requests, Network Load Balancer handles TCP and UDP connections, and Gateway Load Balancer handles IP packets bound for security appliances. This page covers the shared concepts and a comparison table, then walks through each of the three types.
All three types use the same building blocks: listeners, target groups, and health checks.
Load balancer types (ALB · NLB · GWLB)
GENEVE port between GWLB and appliances
Maximum packet size on GWLB interfaces (bytes)
ALB mutual TLS authentication (passthrough · verify)
Common building blocks
A load balancer continuously checks target health and sends traffic only to healthy targets. When Auto Scaling groups or containers change, the address clients use stays the same. All three types share the building blocks below.
Listener
A listener accepts connections on a protocol and port and passes them to target groups according to its rules. A GWLB has exactly one listener, with no protocol or port.
Target group
You choose a target type such as instance or ip and register targets. The target type can't be changed after creation, and each target group has its own health checks and attributes.
Health check
Traffic goes only to healthy targets, but if no target is healthy, it goes to all targets. For ALB and NLB, you can set DNS failover and routing failover thresholds as a minimum count or percentage of healthy targets.
Cross-zone
When enabled, each node distributes traffic across targets in all Availability Zones. It is always on at the load balancer level for ALB and off by default for NLB and GWLB.
Deregistration delay
A deregistered target enters the draining state to finish in-flight requests. The default is 300 seconds, after which it becomes unused.
LCU reservation
Reserve minimum capacity ahead of an expected surge. After reserving, the load balancer still scales with traffic but never below the reservation. NLB and GWLB count 1 LCU as 2.2 Mbps.
Type selection
The deciding factor is which layer of the traffic you need to inspect to make a decision.
| Item | ALB | NLB | GWLB |
|---|---|---|---|
| OSI layer | L7 · per request | L4 · per connection · flow | L3 · per packet (transparent gateway) |
| Listener protocols | HTTP · HTTPSHTTP/2 · gRPC on HTTPS listeners | TCP · TLS · UDP · TCP_UDP · QUIC · TCP_QUIC | IP packets on all portsGENEVE (UDP 6081) to appliances |
| Target types | instance · ip · lambda | instance · ip · alb | instance · ip |
| Target selection | round robin (default), least outstanding requests, weighted random | Flow hash on protocol, IPs · ports, and TCP sequence number | 5-tuple (default), 3-tuple, or 2-tuple flow stickiness |
| Static IP | Reached by DNS name. For static IPs, put the ALB behind an NLB | Static IP per Availability Zone; Elastic IPs for internet-facing | GWLB endpoint set as next hop in route tables |
| Security groups | Associated with the load balancer | Can be changed later only if associated at creation | None. Controlled by appliance security groups · NACLs |
| TLS | Terminated on HTTPS listeners, mTLS supported | Terminated on TLS listeners (ALPN policy), or passed through as TCP | Not terminated. Packets go to appliances unchanged |
| Cross-zone load balancing | Always on. Can be turned off at the target group level | Off by default | Off by default |
| Typical use | Web · APIs · microservices, authentication at the front | High-performance TCP · UDP, static IPs, PrivateLink services | Inline inspection such as firewalls and IDS/IPS |
Application Load Balancer · L7
ALB accepts and terminates the client connection, chooses a target group based on the request's host, path, headers, method, query string, and source IP, and then sends the request to the target over a separate connection.
Rules per ALB (excluding default rules, adjustable)
Target groups per forward action
Targets per ALB (adjustable)
Listeners per ALB (adjustable)
ALB · Listener rules
Listener rules are evaluated from the lowest priority number, and the first matching rule's actions run. There are six condition types: host-header, path-pattern, http-header, http-request-method, query-string, and source-ip. host-header, path-pattern, and http-header can also match with regular expressions instead of wildcards.
Each rule must end with exactly one routing action: forward, redirect, or fixed-response. On HTTPS listeners, authenticate-cognito, authenticate-oidc, and jwt-validation actions can come before it. Non-default rules can each carry one transform per type (host-header-rewrite, url-rewrite) that rewrites the request before it reaches the target. A rule can have up to 5 condition values and 6 wildcards.
ALB · Features
Authentication
The authenticate-oidc · authenticate-cognito actions in HTTPS listener rules handle sign-in and pass the authenticated user's claims to targets in headers.
JWT validation
The jwt-validation action verifies the signature with public keys from a JWKS endpoint and checks iss and additional claims. The JWKS response can be up to 150 KB and 10 keys.
mTLS
Verify mode validates client certificates against the CAs in a trust store; passthrough mode passes the certificate chain to targets in a header. Each ALB supports 2 listeners in verify mode.
Transforms
A rule's transform uses regular expressions to rewrite the path, query string, and Host header before sending to the target. You can migrate URL schemes without application code changes or a separate proxy.
Weighted target groups
A single forward action splits requests by weight across up to 5 target groups. With target group stickiness enabled, a client stays in the group it was first assigned to.
Sticky sessions
Requests go to the same target using the ALB-generated AWSALB cookie (duration-based) or an application cookie (application-based). Not available on target groups with cross-zone load balancing turned off.
Algorithms · Slow start
Slow start ramps up a new target's share of requests linearly over 30–900 seconds (round robin only). With weighted random, ATW automatically reduces traffic to targets whose error rates spike.
Lambda targets
The ALB converts the HTTP request into a JSON event and invokes the function. A lambda target group holds a single function, and the function's response JSON can be up to 1 MB.
HTTP/2 · gRPC
Set the protocol version of a target group behind an HTTPS listener to gRPC or HTTP2 to forward that traffic as is. A WebSocket connection stays on the target that accepted the upgrade.
With Target Optimizer enabled, an agent installed on each target enforces a maximum number of concurrent requests per target. It can be enabled only when you create the target group; once enabled, the algorithm is round robin only and sticky sessions aren't supported.
Network Load Balancer · L4
NLB pins each TCP · UDP flow to one target using a flow hash and has a static IP in each Availability Zone. Unless the listener is TLS, it passes traffic through without opening the payload, and it scales to handle millions of requests per second.
dns_record.client_routing_policy sets the same-zone affinity to 100, 85, or 0%.Targets per NLB (500 with cross-zone load balancing)
Targets per Availability Zone per NLB (adjustable)
Default TCP idle timeout
Listeners per NLB
NLB · Features
Protocols · QUIC
QUIC · TCP_QUIC listeners pass QUIC v1 traffic to targets without decryption. They pin targets by the Server ID in the Connection ID, so mobile clients keep their sessions across connection migration.
Static IP
NLB nodes have a static IP in each Availability Zone. An internet-facing NLB can attach one Elastic IP per subnet, so clients can keep a fixed allow list.
Source IP
By default it is on for instance targets and off for TCP · TLS on ip targets. It can't be turned off for UDP · TCP_UDP · QUIC · TCP_QUIC. It doesn't work for targets reached through Transit Gateway, so use Proxy Protocol v2 to pass the IP.
PrivateLink
Register the NLB as a VPC endpoint service, and interface endpoints in consumer VPCs connect to the NLB. You can choose whether security group inbound rules apply to PrivateLink traffic.
Security groups
You must associate a security group at creation to be able to change it later. Referencing the NLB security group as the source in target security groups allows both data and health check traffic.
TLS · ALPN
A TLS listener terminates TLS with an ACM certificate and a security policy. Choose an ALPN policy from HTTP1Only, HTTP2Only, HTTP2Optional, HTTP2Preferred, and None.
Weighted TG
A single NLB listener splits traffic across multiple target groups with weights from 0 to 999. It works with instance, ip, and alb target groups, which suits blue/green and canary deployments.
Zonal shift · DNS failover
ARC zonal shift takes one Availability Zone out of traffic. When a zonal health check fails, that zone's DNS record is removed; check it with the ZonalHealthStatus metric.
ALB as target
Register one ALB in an alb target group to put static IPs and PrivateLink in front of it. For quota purposes, one ALB counts as 50 targets (100 with cross-zone load balancing).
On a dual-stack NLB, you can add listener rules besides the default rule to send traffic to different target groups based on the source IP address type (IPv4 · IPv6). Each rule must have one forward action.
Gateway Load Balancer · L3
GWLB receives IP packets on all ports, encapsulates them in GENEVE, and distributes them across a fleet of virtual appliances such as firewalls, IDS/IPS, and DPI. It acts as a transparent gateway, a single entry and exit point, and scales the number of appliances with demand.
GENEVE target group protocol · port
Appliance MTU needed to receive 8,500-byte packets
Targets per GWLB (not adjustable)
Listener per GWLB
GWLB · Features
GENEVE
The GENEVE header carries flow information in a TLV with Option Class 0x0108, and the appliance decapsulates it to process the original packet. Dual stack also uses an IPv4 GENEVE header.
MTU
GWLB interfaces accept packets up to 8,500 bytes and drop larger ones. GWLB doesn't support IP fragmentation and doesn't generate "fragmentation needed" ICMP messages, so PMTUD doesn't work.
GWLB endpoint
A VPC endpoint that serves as a route table next hop. It uses PrivateLink to connect consumer VPCs to appliances in the provider VPC, so multiple VPCs and accounts share one inspection fleet.
Flow stickiness
The default is 5-tuple; you can switch to source_ip_dest_ip_proto (3-tuple) or source_ip_dest_ip (2-tuple). With 3- or 2-tuple, the idle timeout can't be changed.
Target failover
Set target_failover to rebalance to move existing flows to another target when a target becomes unhealthy or is deregistered. The default is no_rebalance, and both attributes must have the same value.
Idle timeout
TCP flows default to 350 seconds (60–6,000 seconds), and UDP is fixed at 120 seconds. If you raise it above 350 seconds, set the target ENI's connection tracking timeout to at least the same value.
TGW appliance mode
With appliance mode enabled on the security VPC attachment, the TGW picks one ENI by flow hash and keeps both directions of traffic in the same Availability Zone. Attach only one TGW to the security VPC.
Route design
Spoke VPCs send the default route to the TGW, and the TGW sends it to the security VPC attachment. In the security VPC, the TGW attachment subnet routes to the GWLB endpoint, and the endpoint subnet routes back to the TGW.
Partners
Vendors registered as ELB partners have integrated and validated their appliances with GWLB. However, choosing and validating the appliance software remains your responsibility.
GWLB allows asymmetric flows where the return traffic of a flow whose first packet it processed bypasses the GWLB, but this isn't recommended. Flows where only the return traffic reaches the GWLB, without the GWLB seeing the first packet, aren't supported.
Reference architecture · ALB
Requests that pass through CloudFront and AWS WAF arrive at an internet-facing ALB spanning two AZs, which accepts them with an ACM certificate. Listener rules split them by host · path condition across ECS Fargate, EC2, and Lambda target groups, authenticating first with Cognito · OIDC when required.
On narrow screens, swipe the diagram sideways.
Reference architecture · NLB
An internet-facing NLB attaches one Elastic IP per AZ, so on-premises firewalls can build allow lists from static IPs. Targets can be EC2 instances, IPs, or an ALB, and other accounts are served over PrivateLink by an internal NLB set up as an endpoint service.
On narrow screens, swipe the diagram sideways.
Reference architecture · GWLB
The GWLB in the security VPC serves as an endpoint service, and each VPC uses its GWLB endpoint as a route next hop. IGW ingress routing sends inbound traffic, and Transit Gateway sends spoke VPC outbound traffic, to the endpoints; only traffic that has passed through the appliances reaches its destination.
On narrow screens, swipe the diagram sideways.
Getting started
All three types are built in the same order. The differences are the listener protocol and target type, plus, for GWLB, the endpoints and route tables.
Choose a type from the comparison table and pick one subnet per Availability Zone. Decide on internet-facing or internal and the IP address type (IPv4 · dual stack) at this point.
Associate security groups with the ALB and NLB. For an NLB, associate them at creation to be able to change them later. For GWLB, allow GENEVE 6081 in the appliance security groups.
Choose the target type and protocol and register targets. Tune attributes such as the health check path, deregistration delay, and sticky sessions.
For ALB and NLB, create listeners, certificates, and rules. For GWLB, create the endpoint service and GWLB endpoints and add them to route tables as the next hop.
Point your domain at the load balancer with a Route 53 alias record, and track target health and capacity unit usage with CloudWatch metrics and access logs.
Pricing
All three types are billed for load balancer hours and capacity unit (LCU · NLCU · GLCU) usage. Each hour, capacity units are calculated from whichever of several dimensions has the highest usage.
| Component | What one capacity unit covers | Notes |
|---|---|---|
| Load balancer hours | Hours an ALB · NLB · GWLB runs (partial hours billed as full hours) | Rates differ by type |
| ALB LCU | 25 new connections/s · 3,000 active connections/min · 1 GB processed/hour · 1,000 rule evaluations/s | The first 10 rules processed are free. With mTLS, 1,500 active connections/min; for Lambda targets, 0.4 GB/hour |
| NLB NLCU | TCP 800 new connections/s · 100,000 active/min UDP 400 new flows/s · 50,000 active/min TLS 50 new connections/s · 3,000 active/min | Processed bytes are 1 GB/hour for all three protocols |
| GWLB GLCU | 600 new connections · flows/s · 60,000 active/min · 1 GB processed/hour | GWLB endpoints are billed under AWS PrivateLink pricing for endpoint hours and GB processed |
| Capacity reservation | Reserved capacity unit-hours | When using Load Balancer Capacity Unit Reservation. Usage above the reservation is billed separately |
| Related charges | Billed by other services | Data transfer (Amazon EC2 pricing) and public IPv4 addresses used by the load balancer (Amazon VPC pricing) |
Rates vary by Region and usage. For current rates, see the Elastic Load Balancing pricing page.
Next step
Bring your protocols, static IP needs, authentication method, and inspection requirements, and we'll review the ALB · NLB · GWLB placement together.