Skip to Content

Network Load Balancer

The layer 4 load balancer for TCP, UDP, TLS and QUIC, with static IPs per AZ, extreme performance, and instance, IP or ALB targets.

What it is

The Network Load Balancer (NLB) works at layer 4: it forwards TCP and UDP connections without looking inside the HTTP requests.

  • Handles millions of requests per second with ultra-low latency, and absorbs sudden spikes.
  • Listeners for TCP, TLS (secure TCP), UDP, TCP_UDP, and now QUIC.
  • One static IP address per AZ, and the account's own Elastic IPs can be assigned to an internet-facing NLB. That's helpful when clients must allow-list specific IPs.
  • Used for extreme performance, non-HTTP protocols (gaming, IoT, VoIP, databases), and anything needing static IPs.

Target groups

Clients send TCP or UDP traffic to an NLB with a static IP per AZ, which forwards to EC2 instances, private IP addresses, or an Application Load Balancer Clients send TCP or UDP traffic to an NLB with a static IP per AZ, which forwards to EC2 instances, private IP addresses, or an Application Load Balancer

Three kinds of NLB target.

An NLB target group contains one kind of target:

  • EC2 instances;
  • IP addresses, which must be private IPs (instances, containers or on-premises servers);
  • an Application Load Balancer: the NLB gives the static IPs, the ALB does the HTTP routing behind it.

Health checks can use TCP, HTTP or HTTPS, even when the traffic itself is TCP or UDP.

How traffic flows

  • An NLB keeps each TCP connection (or UDP flow) on one target for its whole life, choosing by a hash of the source and destination addresses and ports.
  • For instance targets, the target sees the client's real IP (client IP preservation), unlike with an ALB.
  • With a TCP listener on port 443, traffic passes through still encrypted, so the targets decrypt it. With a TLS listener, the NLB terminates TLS itself.
  • NLBs now support security groups, so instance security groups can reference the NLB's group, as with an ALB.

Updated since the slides

NLBs gained security groups in 2023 (before, client IPs had to be allowed on the targets), and they now support QUIC listeners for HTTP/3-style traffic. Cross-zone load balancing is still off by default for NLBs.

ALB or NLB?

  • HTTP-aware routing, redirects, authentication, Lambda targets → ALB.
  • TCP or UDP, extreme performance, static or Elastic IPs, client IP preserved → NLB.
  • Both static IPs and HTTP routing → NLB in front of an ALB.

Exam tips

  • "TCP / UDP traffic", "millions of requests per second", "ultra-low latency" → NLB.
  • "Static IP address" or "Elastic IP" for a load balancer, "clients allow-list our IPs" → NLB.
  • "Static IPs and path-based routing" → NLB with an ALB as the target (or Global Accelerator in front of an ALB).
  • "End-to-end encryption, targets must decrypt" → NLB with a TCP listener on 443 (passthrough).
  • "Gaming, VoIP, IoT over UDP" → NLB.

Common traps

  • "Route by URL path on an NLB." NLBs don't read HTTP; use an ALB.
  • "NLB targets can be Lambda functions." Lambda targets are for ALBs.
  • "Target IPs can be public." IP targets must be private.

Check yourself

An NLB lab works like the ALB lab with the same cost, so instead of repeating it:

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt