Network Load Balancer

Handle massive amounts of traffic using AWS Network Load Balancer.

Akshay Bhadange
Pythonistas
Published in
4 min readMar 25, 2022

--

What is Elastic Load Balancer?

Elastic Load balancer automatically distributes incoming requests across multiple AWS resources, such as EC2 instances, containers, IP Addresses in multiple Availability Zones (AZs). It also enables users to monitor incoming traffic, the status of requests, the health of registered targets. An elastic load balancer scales your load balancer as your incoming traffic changes over time.

Which load balancer is right for your application?

You should evaluate all available AWS Load balancers and consider the needs of your application. Here are some guidelines.

  1. Application Load Balancer (ALB)

The application load balancer is good for advanced load balancing of HTTP and HTTPS traffic. ALB supports advanced request routing for modern applications such as microservices and container-based applications. In order to manage applications with flexibility, you can use Application Load Balancers, which function at the seventh layer of the Open Systems Interconnection (OSI) model.

2. Network Load Balancer (NLB)

Ideal for load balancing of TCP traffic, NLB is capable of handling millions of requests per second while maintaining ultra-low latencies. NLB is optimized to handle sudden and volatile traffic patterns while using a single static IP address per Availability Zone. If your application needs extreme performance and static IP then you can use the Network Load balancer functions at the seventh layer of the Open Systems Interconnection (OSI) model.

3. Classic Load Balancer (CLB)

Ideal for applications that were built within the EC2-Classic network.

Getting started with Network Load Balancer

This blog provides a hands-on introduction to Network Load Balancers. To create your first Network Load Balancer follow these steps

Step 1: Create Target Group

Target Group tells a load balancer where to direct traffic to it can be EC2 instance, IP Address, Lambda Function or Application Load Balancer.

  1. For this demo keep Target Type as an instance and enter a name for the new target group.
  2. Keep Protocol as TCP and Port as 80.
  3. Select VPC, Select protocol version as HTTP1 and configure Helth checks
  4. On the Register target page, Select EC2 Instance and click on Include as pending below and save Target group configuration.

Step 2: Create Load Balancer

  1. Open EC2 console and navigate to Load Balancer under Load Balancing menu.
  2. Create Load Balancer and choose Network Load Balancer.
  3. Enter Load Balancer Name
  4. Select Scheme and IP Address Type
  5. Configure Network Mapping:- It helps to route traffic to targets in the selected subnet. Select VPC and Availability Zone.

Network Load Balancer supports static IP addresses for the load balancer. You can also assign one Elastic IP address per subnet enabled for the load balancer.

6. Configure Listener and Routing, As we have created a target group that listens to TCP port 80. Keep the default.

7. Create Load Balancer

Your Load Balancer is ready and to test your load balancer follow these steps

  • Select your Network Load Balancer and copy the DNS name and paste it into the address field of the web browser.
Source: AWS Elastic Load Balancing

Benefits of Network Load Balancer

  1. Ability to run complex web or containerized applications and scale to handle millions of requests per second.
  2. Ability to handle volatile workloads.
  3. Support for Static IP address for the load balancer which can be assigned from a pool of available Elastic IP addresses.
  4. Easy Integration with other AWS Services like AWS Certificate Manager (ACM), Elastic Container Service (ECS), Route 53, Auto Scaling Group, Application Load Balancer, CloudWatch, CloudTrail.
  5. AWS NLB supports long-lived TCP connections that are ideal for WebSocket type of application.
  6. Layer 4 Load Balancing will load balance both TCP and UDP traffic, and route traffic to targets such as EC2 Instance, Application Load Balancer or Container.

How to Protect your Network load Balancer

AWS Shield Advanced can help to protect your Network Load Balancer against infrastructure-layer Distributed Denial of Service (DDoS) attacks. Enable AWS Shield Advanced on an AWS Elastic IP address and attach the address to an internet-facing Network Load Balancer. AWS Shield Advanced automatically detects the type of AWS resource behind the Elastic IP address and mitigates DDoS attacks.

AWS Shield Advanced ensures that all your Network Access control lists (ACLs) are automatically executed on AWS Shield. For every incident detected by AWS Shield Advanced, you also get near-real-time visibility via Amazon CloudWatch metrics and details about the incident, such as the geographic origin and source IP address of the attack.

--

--