Skip to main content

Command Palette

Search for a command to run...

Day - 22 | AWS Load Balancers

Published
โ€ข3 min read

AWS Load Balancers Explained: ALB vs NLB vs GWLB

As part of my AWS learning journey, I recently explored AWS Elastic Load Balancing (ELB) and its three main load balancer types: Application Load Balancer (ALB), Network Load Balancer (NLB), and Gateway Load Balancer (GWLB).

Each load balancer is designed for a specific purpose and traffic pattern. Choosing the right one is critical for performance, scalability, and security.

In this blog, Iโ€™ll explain ALB vs NLB vs GWLB, how they work, and when to use each.

โ˜๏ธ What is AWS Elastic Load Balancing?

AWS Elastic Load Balancing automatically distributes incoming traffic across multiple targets (EC2 instances, containers, IPs, or Lambda functions). It helps achieve:

  • High availability

  • Fault tolerance

  • Scalability

AWS provides different types of load balancers to handle traffic at different layers of the OSI model.

๐ŸŒ Application Load Balancer (ALB)

๐Ÿ”น What is ALB?

Application Load Balancer (ALB) operates at Layer 7 (Application Layer). It is designed to handle HTTP and HTTPS traffic and makes routing decisions based on content.

๐Ÿ”น Key Features

  • Layer 7 (HTTP/HTTPS)

  • Path-based routing (e.g., /api, /login)

  • Host-based routing (e.g., api.example.com)

  • Supports WebSockets

  • Integrates with AWS WAF

  • Native support for ECS and Kubernetes

๐Ÿ”น Use Cases

  • Web applications

  • Microservices architectures

  • REST APIs

  • Container-based applications

โšก Network Load Balancer (NLB)

๐Ÿ”น What is NLB?

Network Load Balancer (NLB) operates at Layer 4 (Transport Layer) and is built to handle very high throughput and low latency.

๐Ÿ”น Key Features

  • Layer 4 (TCP, UDP, TLS)

  • Extremely low latency

  • Can handle millions of requests per second

  • Preserves client IP address

  • Supports static IP addresses

  • Suitable for sudden traffic spikes

๐Ÿ”น Use Cases

  • High-performance applications

  • Real-time gaming

  • Financial systems

  • TCP/UDP-based workloads

๐Ÿ” Gateway Load Balancer (GWLB)

๐Ÿ”น What is GWLB?

Gateway Load Balancer (GWLB) is designed to deploy, scale, and manage third-party virtual appliances such as firewalls, intrusion detection systems, and deep packet inspection tools.

It works with transparent network gateways and integrates with VPC traffic flows.

๐Ÿ”น Key Features

  • Operates at Layer 3/4

  • Uses GENEVE protocol

  • Supports transparent traffic inspection

  • Scales security appliances automatically

  • Centralized security architecture

๐Ÿ”น Use Cases

  • Network firewalls

  • Intrusion detection and prevention systems (IDS/IPS)

  • Traffic inspection

  • Security compliance enforcement

๐Ÿ“Š ALB vs NLB vs GWLB (Comparison)

FeatureALBNLBGWLB
OSI LayerLayer 7Layer 4Layer 3/4
ProtocolsHTTP, HTTPSTCP, UDP, TLSGENEVE
LatencyLowUltra-lowLow
Routing TypeContent-basedConnection-basedGateway-based
Client IPOptionalPreservedPreserved
Best ForWeb & APIsHigh performanceSecurity appliances

๐Ÿง  How to Choose the Right Load Balancer

  • Choose ALB if you need smart routing for HTTP/HTTPS traffic

  • Choose NLB if you need extreme performance and low latency

  • Choose GWLB if you need centralized security and traffic inspection

There is no one-size-fits-all; the choice depends on your architecture and workload requirements.