AWS Builder Center

ALB vs NLB vs Gateway Load Balancer: Which One Do You Need?

A plain-English comparison of AWS's three main load balancers, what layer each works at, and a simple way to decide between them.

Three load balancers, three jobs

AWS offers several types of Elastic Load Balancing, and the names are easy to mix up. The three you'll meet most often are the Application Load Balancer (ALB), the Network Load Balancer (NLB) and the Gateway Load Balancer (GWLB). The quickest way to tell them apart is to ask which layer of the network each one works at and what it's built to do.

Application Load Balancer: smart routing for web traffic

The ALB works at layer 7, so it understands HTTP and HTTPS. That lets it make routing decisions based on the content of a request, such as the hostname, the URL path, headers or query strings. You can send  /api/*  to one group of servers and  /images/*  to another, or host several sites behind a single load balancer. It supports WebSockets and HTTP/2, can terminate TLS, and its targets can be EC2 instances, containers, IP addresses or Lambda functions. If you're running a website or a microservices API, this is usually your starting point.

Network Load Balancer: speed and raw connections

The NLB works at layer 4, handling TCP, UDP and TLS traffic without looking inside the requests. Because it does less, it handles extremely high volumes of traffic with very low latency. It provides a static IP address per Availability Zone, and you can attach your own Elastic IPs, which is helpful when partners need to allow-list fixed addresses. It also preserves the client's source IP address. Choose it for non-HTTP protocols, gaming or streaming workloads, or any case where performance and fixed IPs matter more than content-based routing.

Gateway Load Balancer: for security appliances

The GWLB is the odd one out. It works at layer 3 and exists to send traffic through third-party virtual appliances, such as firewalls or intrusion detection systems, and then scale and balance them. Traffic is forwarded to the appliances using the GENEVE protocol. You won't choose it to serve your own application. You use it when your organization needs to inspect network traffic with a security tool.

A simple way to choose

If it's web traffic and you want routing based on paths or hostnames, use an ALB. If it's TCP or UDP traffic, you need static IPs, or you need the highest performance, use an NLB. If you need to inspect traffic with a third-party security appliance, use a GWLB. When a question says "path-based routing", think ALB. When it says "static IP" or "millions of requests per second", think NLB. When it mentions "firewall appliances", think GWLB.

Wrap-up

The three load balancers aren't competitors, they're tools for different layers. Once you remember "application, network, gateway" and the layer each one works at, the choice usually becomes obvious. Which one do you use most in your own projects?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article