Hands-on AWS knowledge base for developers Managed Ops
Talk to Us

Network Load Balancer vs Application Load Balancer: the difference

Export PDF Print-friendly layout with a copyright watermark; choose Save as PDF in the print dialog
Network Load Balancer vs Application Load Balancer: the difference

TL;DR

  • If the traffic is HTTP or HTTPS, pick ALB. NLB only earns its keep when the protocol isn't HTTP, when a client hardcodes an IP that can't change, or when you're publishing a PrivateLink endpoint.
  • The difference that actually pages you at 2am isn't routing features — it's failure modes. ALB's 60-second idle timeout turns slow endpoints into 504s, and NLB's default TCP health check will keep routing traffic to an app that answers every request with a 500.
  • Hourly list price is near-identical ($0.0225/hour for both in us-east-1); the bill diverges on LCU vs NLCU math, and the load balancer is rarely the biggest line on an SMB account anyway.

The verdict: ALB, unless the protocol says otherwise

Application Load Balancer is the default answer for anything serving HTTP or HTTPS to browsers, mobile clients, or other services. Host and path routing, HTTP-status-aware health checks, per-target 5xx metrics, WAF attachment, and OIDC/Cognito auth at the listener are all bundled into the LCU price. Rebuilding that behind an NLB means running nginx or Envoy yourself and paying for the EC2 hours anyway.

Network Load Balancer is the correct answer in a much narrower band of cases: raw TCP or UDP, a client that pins your IP inside a firewall rule, TCP source-IP preservation for licensing or legacy allowlists, or an endpoint service consumed over PrivateLink. On a typical SMB account that's one workload in ten.

The migration direction matters too. Moving NLB → ALB is usually a DNS cutover with a 60-second TTL and a week of running both (about $16 of overlapping LB hours at list). Moving ALB → NLB means losing WAF, host routing, and every error-rate metric you've been alerting on.

The decision tree, in one table

Start at the protocol question and stop at the first row that matches.

Requirement Pick Why
HTTP/HTTPS, path or host routing to multiple services ALB Rules are free to add; each rule eval counts toward LCU
AWS WAF, Cognito/OIDC auth, fixed-response redirects ALB No WAF attachment point on NLB listeners
gRPC or WebSockets over HTTP/2 ALB End-to-end HTTP/2 on an HTTPS listener
Lambda targets (serverless backend) ALB NLB has no Lambda target type
Raw TCP, UDP, MQTT, syslog, SMTP, game traffic NLB ALB only speaks HTTP/HTTPS/gRPC
Client hardcodes an IP, or you need an EIP per AZ NLB One static IP per AZ; ALB node IPs rotate
TCP source IP must reach the target unchanged NLB ALB gives you X-Forwarded-For instead
Endpoint service for another VPC or account NLB PrivateLink requires NLB
Client IP allowlist at the app layer NLB, or ALB + Global Accelerator Accelerator gives static anycast IPs in front of ALB

Where the two really diverge in production

Dimension ALB NLB
Layer 7 (HTTP/HTTPS/gRPC/WebSocket) 4 (TCP/UDP/TLS)
Health checks HTTP path + status matcher, app-aware TCP port open by default; HTTP/HTTPS optional
Source IP at target ALB node IP + X-Forwarded-For Client IP preserved unchanged
Static IP No One EIP per AZ
Security groups Yes Yes, since 2023 (older guides say no)
WAF Attachable Not supported
Access logs Full request line, status, timings, ~every 5 min TLS/connection metadata only
CloudWatch

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *