AWS in 1 Min · Episode 72

ALB vs NLB vs GWLB: which AWS load balancer to use

Three load balancers, three jobs. Watch the one-minute video, then read the details.

David Gomez1:20 video · 3 min read

"All load balancers do the same job." They all spread traffic, but AWS offers three current types that work at different layers of the network, and each can do things the others can't. Pick the wrong one and the feature you need, such as routing by URL or a fixed IP address, simply isn't there.

ALB: the one that understands HTTP

The Application Load Balancer works at layer 7, the application layer. It speaks HTTP and HTTPS (and gRPC), so it can read each request and decide where it goes based on its content:

  • the path (/images to one service, /checkout to another),
  • the host name (several domains on one load balancer),
  • headers, HTTP method, query string or source IP.

That makes it the default choice for websites, APIs and microservices. It can also terminate TLS with certificates from AWS Certificate Manager, authenticate users before forwarding a request, work with AWS WAF, and send requests to Lambda functions as targets.

NLB: the one built for connections

The Network Load Balancer works at layer 4, the transport layer. It doesn't look inside requests; it forwards TCP and UDP connections (and can terminate TLS). In exchange you get:

  • very high scale: AWS says it can handle millions of requests per second and volatile traffic,
  • a static IP address per Availability Zone, and you can attach your own Elastic IP addresses,
  • support for non-HTTP protocols: databases, game servers and other custom protocols.

Use it when raw performance matters, when the protocol isn't HTTP, or when clients must allowlist fixed IP addresses in their firewalls. An ALB's addresses can change; an NLB's don't. You can even put an NLB in front of an ALB to get fixed addresses and HTTP routing together.

GWLB: the one for security appliances

The Gateway Load Balancer is a different animal. It works at layer 3 and exists to put virtual appliances in the path of your traffic: third-party firewalls, intrusion detection and prevention systems, deep packet inspection. It listens for all IP packets on all ports, spreads the flows across a fleet of appliances, keeps each flow on the same appliance, and sends the traffic on once it has been inspected.

If you aren't running that kind of appliance fleet, you don't need a GWLB. It isn't a faster or bigger version of the other two.

How to choose

  1. HTTP or HTTPS, and you want routing by content? ALB.
  2. Any other protocol, extreme throughput, or fixed IPs? NLB.
  3. Traffic must pass through inspection appliances? GWLB.

You may still meet the Classic Load Balancer, the previous generation. It remains for existing applications, but new work should use one of the three above.

A common mistake is choosing an NLB "because it's faster" for an ordinary web app, then discovering there is no path-based routing, no redirects and no WAF integration.

Where AI fits

Most AI services are HTTP APIs, so an ALB is the natural front door: one load balancer can route /v1/chat and /v1/embeddings to different model fleets, and its target groups can use the least outstanding requests algorithm, which suits slow, uneven inference calls. One thing to check for long streamed responses is the ALB's idle timeout, 60 seconds by default: if a connection sends no data for that long it is closed, so keep data flowing or raise the setting.

Choose an NLB when the workload is a raw, low-latency stream rather than request and response: for example real-time audio or video over UDP, or a custom TCP protocol between services.

Quick recap

  • ALB: layer 7, HTTP routing by path, host and header. Websites, APIs, AI APIs.
  • NLB: layer 4, TCP and UDP, static IPs, very high throughput.
  • GWLB: layer 3, sends traffic through security appliances.
AWS in 1 Min #72 · 1:20

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS