AWS Network Load Balancer Guide: What You Need to Know
6 min read
Table of contents
- š© The New Use Case: Beyond HTTP
- š” Why Do We Need a Network Load Balancer?
- āļø What Is the Network Load Balancer?
- š” Use Cases Where ALB Canāt Help
- š Connection-Based (NLB) vs. Request-Based (ALB) ā SAA Focus
- š§± NLB Target Groups (Where the Traffic Goes)
- š Bonus: You Can Use NLB in Front of ALB
- š Health Checks in NLB
- š° Important Note: NLB Is Not in the Free Tier
- š§ Final Recap: When Should You Use Network Load Balancer?
- š Arjunās Takeaway
After building and scaling his web application using Application Load Balancer (ALB), Arjun felt like a cloud champion.
He had:
Smart routing based on paths and domains
HTTPS termination
Health checks
And everything working behind one clean URL
But just when things were smooth⦠a new requirement landed on his desk.
š© The New Use Case: Beyond HTTP
One of the backend teams was building a real-time multiplayer game server. They said:
āWe need to handle TCP and UDP traffic, not HTTP.ā
Arjun paused.
āBut... ALB only works with HTTP and HTTPS... right?ā
Correct. ALB is Layer 7, meaning it works only with web traffic (HTTP/HTTPS). It doesn't understand lower-level protocols like TCP or UDP.
Thatās when Arjun was introduced to the Network Load Balancer (NLB).
š” Why Do We Need a Network Load Balancer?
Feature | ALB | NLB |
Layer | 7 (Application) | 4 (Transport) |
Protocols | HTTP / HTTPS | TCP / UDP / TLS |
Advanced Routing | Yes (based on URL, headers, etc.) | No |
Speed | Good | ā” Ultra-fast |
Millions of Connections/sec | š« Not ideal | ā Designed for it |
Static IP Support | No | ā Yes |
Real-time, Low-Latency | š« Not optimal | ā Perfect |
Web Apps | ā Great | ā If needed |
Network-level apps (VPNs, chat, games) | š« Not supported | ā Best fit |
A Network Load Balancer (NLB) is a Layer 4 load balancer in AWS that routes traffic using the TCP, UDP, or TLS protocols. Itās designed to handle millions of connections per second with ultra-low latency.
Unlike ALB, it doesnāt inspect web requests or support things like path-based routing. It just moves packetsāfast and reliably.
Bottom line?
If youāre working with protocols other than HTTP/HTTPS, or need extreme performance + static IPsāNLB is the answer.
āļø What Is the Network Load Balancer?
A Network Load Balancer (NLB) is a Layer 4 load balancer in AWS that routes traffic using the TCP, UDP, or TLS protocols. Itās designed to handle millions of connections per second with ultra-low latency.
Unlike ALB, it doesnāt inspect web requests or support things like path-based routing. It just moves packetsāfast and reliably.
š” Use Cases Where ALB Canāt Help
Hereās what made Arjun go for NLB:
1. TCP/UDP Traffic (Not HTTP)
Game servers
VPN gateways
IoT device communications
Chat and messaging apps
2. Static IP Requirements
One day, Arjunās security team said:
āOur payment partner only accepts traffic from known IP addresses. Can we give them our appās IP?ā
Arjun checkedāand realized Application Load Balancer (ALB) couldnāt help. ALB uses changing IPs, which canāt be whitelisted by other systems.
Why?
NLB gives you one static IP per Availability Zone
You can even attach Elastic IPsāwhich are fixed and owned by you
These IPs never change, even if the load balancer restarts
ā This made it easy for Arjun to:
Share static IPs with partners
Set up firewall rules
Build integrations with systems that require fixed IPs
3. Extreme Performance Needs
The app needed to support hundreds of thousands of concurrent connections.
NLB is connection-based, not request-based
It can handle millions of connections per second without breaking a sweat
š Connection-Based (NLB) vs. Request-Based (ALB) ā SAA Focus
Network Load Balancer (NLB) is connection-based, which means it routes all data in a single TCP or UDP connection to the same backend server. It doesnāt inspect individual requestsājust maintains and forwards the connection.
In contrast, an Application Load Balancer (ALB) is request-based. It looks at each HTTP/HTTPS request and can route different requestsāeven from the same connectionāto different target groups based on things like path, headers, or hostnames.
ā Summary:
Load Balancer | Routing Type | Works Best For |
NLB | By connection (TCP/UDP) | Real-time apps, chat, VPN, IoT |
ALB | By request (HTTP/HTTPS) | Websites, APIs, microservices |
š SAA Tip: If the question mentions "connection persistence" or "non-HTTP protocols", think NLB. For smart HTTP routing, think ALB.
š§± NLB Target Groups (Where the Traffic Goes)
Just like ALB, NLB uses target groups to define where traffic should go.
Supported target types:
EC2 Instances
Private IP addresses (even on-premises servers)
Note: With NLB, you can register IP addresses directly, including IPs in your own data centerāperfect for hybrid environments.
š Bonus: You Can Use NLB in Front of ALB
Hereās something cool Arjun didnāt expect:
He could put an NLB in front of an ALB.
Why?
NLB gave him static IPs and performance
ALB handled all his smart HTTP rules
This combo gave Arjun the best of both worlds.
š Health Checks in NLB
NLB performs health checks at the target group level.
It supports 3 types of health check protocols:
Protocol | Use Case |
TCP | Just checks if the port is open |
HTTP | Expects an HTTP response like 200 OK |
HTTPS | Encrypted health checks |
If a target fails, NLB stops sending traffic to itākeeping the app reliable.
š° Important Note: NLB Is Not in the Free Tier
Arjun noted this carefully:
āUnlike ALB, NLB is not included in the AWS Free Tier.ā
He made sure to set it up only for production use or controlled testing.
š§ Final Recap: When Should You Use Network Load Balancer?
Use NLB when:
ā
You need to handle TCP, UDP, or TLS traffic
ā
You require static IPs or Elastic IPs
ā
You want ultra-low latency
ā
You expect massive amounts of connections
ā
You have non-HTTP services, like games, messaging, VPNs
ā
You need to load balance across on-prem servers
š Arjunās Takeaway
Arjun realized that ALB and NLB arenāt competing toolsātheyāre designed for different layers of networking.
Use ALB for smart web traffic routing (Layer 7)
Use NLB for raw network-level traffic (Layer 4)
āNow I know when to use each oneāand how they can even work together.ā