Balancing Layer 4 Traffic with a Network Load Balancer
This lesson explains how the Network Load Balancer works at layer 4, handling millions of requests per second with very low latency, static IP addresses and preserved client IPs.
Learning outcomes
After completing this lesson, you will be able to:
- Describe NLB characteristics such as static IP addresses.
- Choose target types.
- Explain the NLB's role as the front end of a PrivateLink service.
- Explain cross-zone load balancing on an NLB.
Characteristics
The Network Load Balancer (NLB) operates at layer 4. It balances TCP, UDP and TLS connections using flow hashing, so each connection stays on one target for its lifetime, and it handles sudden traffic spikes and long-lived connections, such as those of IoT devices, games and financial data feeds, with very low latency.
An NLB has one static IP address per Availability Zone, and Elastic IP addresses can be assigned, so clients and corporate firewalls can allow-list it, which an ALB, whose addresses change, does not allow. It preserves the client's source IP address; when targets are registered by IP address or sit behind proxies, Proxy Protocol v2 carries it. NLBs support security groups, can terminate TLS with ACM certificates, and can pass TCP traffic through unchanged when encryption must reach the targets.
Targets
A Network Load Balancer supports three types of target. Instance targets are EC2 instances registered by ID, and the instance sees the client's original IP address. IP address targets are registered by address, so they can be containers with their own addresses, resources in peered VPCs, or servers on premises reached over VPN or Direct Connect. An Application Load Balancer can itself be the target, which combines the NLB's static IP addresses, useful for clients that allow-list addresses, with the ALB's HTTP routing. The following table summarises the target types.
| Target type | Use |
|---|---|
| Instances | EC2 instances by ID |
| IP addresses | Containers, on-premises servers |
| Application Load Balancer | Static IPs in front of ALB features |
NLB targets
PrivateLink
An NLB is the front end of a PrivateLink endpoint service, exposing a service privately to other VPCs and accounts through interface endpoints, even when their CIDRs overlap.
Cross-zone load balancing
Cross-zone load balancing is off by default on NLBs, so each node sends traffic only to targets in its own AZ. If targets are unevenly spread, enabling it evens the load but adds inter-AZ data charges.
The following diagram shows the effect of the setting on unevenly spread targets.

Static IPs for a partner integration
Partners connect to a payments API over TLS and must allow-list the destination IP addresses in their firewalls. The API runs on EC2 instances in three AZs.
| Requirement | Design |
|---|---|
| Fixed IP addresses | An NLB with an Elastic IP in each AZ |
| Handle sudden bursts of connections | NLB scales without pre-warming |
| Keep the client IP for auditing | NLB preserves the source IP |
| Encryption to the instances | TLS passthrough, terminating on the instances |
If the API later needs path-based routing or WAF, an ALB can be registered as the NLB's target, keeping the static IPs while adding layer 7 features.
Which load balancer is placed in front of a PrivateLink endpoint service?
Show answer
A Network Load Balancer, or a Gateway Load Balancer for appliances. Consumers in other VPCs reach the service through interface endpoints.
Exam Tips
Remember for the exam
- For static IP addresses, UDP, extreme performance or PrivateLink, use an NLB.
- When you need static IP addresses and ALB features, place an NLB in front of an ALB, or use Global Accelerator.
- For end-to-end TLS to the instances, use NLB TCP passthrough.
- If load is uneven across Availability Zones on an NLB, enable cross-zone load balancing.
- To expose a service privately to other VPCs, put an NLB behind a PrivateLink endpoint service.