When you need ultra-fast, high-throughput load balancing without inspecting the contents of the traffic, a Network Load Balancer (NLB) is the perfect tool.
Network Load Balancers operate at Layer 4 of the OSI model. They route incoming connections based solely on IP addresses and port numbers (TCP/UDP) without terminating the connection or looking at HTTP headers.
When to Use a Network Load Balancer
You should choose an NLB over an Application Load Balancer (ALB) when:
- You need to load balance non-HTTP traffic, such as a PostgreSQL database cluster, a Redis cache, or a custom game server.
- You require end-to-end encryption where the SSL certificate is handled directly by the backend instances (SSL Passthrough).
- You need extremely low latency and high connection throughput.
Creating a Network Load Balancer
- Navigate to Networking > Load Balancers in the LYNIO Console.
- Click Create Load Balancer and select Network Load Balancer.
- Provide a name and select the VPC and Subnet where the load balancer should reside.
- Configure Listeners: A listener defines which port the NLB listens on. For example, add a TCP listener on Port 3306 for a database.
- Configure Target Groups: A target group is the collection of Compute Instances that will receive the traffic. Add your backend instances and specify their port.
- Health Checks: Set up a TCP health check. The NLB will periodically attempt to open a TCP connection to your instances to ensure they are healthy before routing traffic to them.
- Click Deploy.
Security Considerations
Because an NLB simply forwards packets to your backend instances, the original source IP address of the client is preserved. Ensure that the Security Groups attached to your backend instances allow inbound traffic from the IP ranges of your expected clients, not just the Load Balancer itself.