This lab walks you through the steps to create and configure a network load balancer.
Duration: 1 hour.
AWS Region: US East (N. Virginia) us-east-1
Elastic Load Balancing is one of the services provided by AWS to distribute the incoming application or network traffic across multiple targets, such as EC2 instances, containers, and IP addresses.
ELB scales your load balancer based on traffic over time.
ELB makes your applications highly available and fault tolerant.
It uses health checks to detect which instances are healthy and directs traffic only across those instances.
You can add and remove resources from your load balancer depending on your need without disrupting the flow of requests to your applications.
Elastic Load Balancing supports three types of load balancers:
Application Load Balancer
Network Load Balancer
Classic Load Balancer
Application Load Balancer is best suited for load balancing of HTTP and HTTPS traffic
Network Load Balancer is used to distribute the traffic or load using TCP/UDP protocols
Classic Load Balancer provides basic load balancing across multiple Amazon EC2 instances.
The network load balancer (NLB) distributes the traffic based on network variables, such as IP address and destination ports.
NLB is capable of processing traffic and scaling at a much higher rate than the application load balancer.
We can't use some features of the Application Load Balancer such as SSL-offloading, host-based routing, cross-zone load balancing, and a few others.
The complete comparison among load balancers can be found in the link Load balancer differences.
It is not designed to take into consideration anything at the application layer, such as content type, cookie data, custom headers, user location, or the application behavior.
For TCP traffic, NLB selects a target using a flow hash algorithm based on the type of protocol, source IP address, source port, destination IP address and destination port.
TCP connections from a client have different source ports and sequence numbers compared with NLB and can be routed to different targets.
Each individual TCP connection is routed to a single target for a connection.
A UDP flow has the same source and destination, so it is consistently routed to a single target throughout its lifetime.
Different UDP flows have different source IP addresses and ports, so they can be routed to different targets.
The advantage of NLB is that it can manage the traffic to a different port to the same instance.
We can split the request based on the port to different services using the Network Load Balancer, thus NLB allows you to route the traffic among multiple applications running on the same server.
Creating an EC2 instance
Creating a Network Load balancer with two target groups named apache-tg and nginx-tg.
Route traffic to port 80.
Attach the instance with nginx-tg to listen to the Nginx service on port 8080.
Installing Apache and Nginx services in the EC2 instance.
Testing the working of a Load Balancer.
Validation of the lab.
Deleting AWS Resources.