AWS Network Load Balancer (NLB) Overview
- Layer 4 Load Balancer: Deals with TCP and UDP traffic.
- Performance: Capable of handling millions of requests per second with lower latency (~100ms) compared to the Application Load Balancer (ALB) which has ~400ms.
- Static IP per Availability Zone: Offers one static IP per AZ, with the option to assign an Elastic IP to each AZ.
- Use Cases for NLB:
- When applications must be accessed via a limited set of static IPs.
- For extreme performance requirements.
- When handling TCP or UDP traffic.
- Not Free Tier Eligible: Usage of NLB is not included in the AWS free tier.
How NLB Works
- Target Groups: Similar to ALB, NLB redirects traffic to defined target groups.
- Traffic Types: Can handle TCP traffic and can also serve as a front for HTTP traffic by using TCP at the front end.
- Targets:
- Can redirect to EC2 instances.
- Can register IP addresses (must be hardcoded private IPs).
- Use Cases for Targets:
- Redirect to private IPs of EC2 instances.
- Redirect to private IPs of servers in your own data center.
- NLB in Front of ALB: Using NLB in front of ALB to benefit from fixed IP addresses (NLB) and HTTP traffic handling rules (ALB) is possible.
Health Checks
- Protocols Supported: TCP, HTTP, and HTTPS.
- Application Support: If the backend application supports HTTP or HTTPS, health checks can be defined on these protocols.
Summary
The Network Load Balancer is a high-performance, Layer 4 load balancer designed for applications that require low latency and high throughput. It supports static IP addressing and handles TCP and UDP traffic. NLB can be used in conjunction with ALB for applications that need fixed IP addresses and advanced HTTP traffic routing rules. Health checks can be performed on TCP, HTTP, and HTTPS protocols to ensure target health.
If you enable multiple Availability Zones for your load balancer, this increases the fault tolerance of your applications. You cannot disable Availability Zones for a Network Load Balancer after you create it, but you can enable additional Availability Zones.