A Network Load Balancer functions at the fourth layer of the Open Systems Interconnection (OSI) model. It can handle millions of requests per second. After the load balancer receives a connection request, it selects a target from the target group for the default rule. It attempts to open a TCP connection to the selected target on the port specified in the listener configuration.
When you enable an Availability Zone for the load balancer, Elastic Load Balancing creates a load balancer node in the Availability Zone. By default, each load balancer node distributes traffic across the registered targets in its Availability Zone only. If you enable cross-zone load balancing, each load balancer node distributes traffic across the registered targets in all enabled Availability Zones. For more information, see Availability Zones.
To increase the fault tolerance of your applications, you can enable multiple Availability Zones for your load balancer and ensure that each target group has at least one target in each enabled Availability Zone. For example, if one or more target groups does not have a healthy target in an Availability Zone, we remove the IP address for the corresponding subnet from DNS, but the load balancer nodes in the other Availability Zones are still available to route traffic. If a client doesn't honor the time-to-live (TTL) and sends requests to the IP address after it is removed from DNS, the requests fail.
Benefits of Network Load Balancer
Ability to handle volatile workloads and scale to millions of requests per second.
Support for static IP addresses for the load balancer. You can also assign one Elastic IP address per subnet enabled for the load balancer.
Support for registering targets by IP address, including targets outside the VPC for the load balancer.
Support for routing requests to multiple applications on a single EC2 instance. You can register each instance or IP address with the same target group using multiple ports.
Support for containerized applications. Amazon Elastic Container Service (Amazon ECS) can select an unused port when scheduling a task and register the task with a target group using this port. This enables you to make efficient use of your clusters.
Support for monitoring the health of each service independently, as health checks are defined at the target group level and many Amazon CloudWatch metrics are reported at the target group level. Attaching a target group to an Auto Scaling group enables you to scale each service dynamically based on demand.
Steps
step 1. Create the VPC(Virtual Private Cloud)
step 2. create the subnets
step 3. Create the Internet Gateway
step 4. Attach the Internet gateway to the vpc
step 5. create the route table and attach internet gateway to the routes of the route table
step 6. Associate the subnets to the routes table
step 7. Create the ec2 instance
step 8. Then connect ec2 and install apache2 by using following code
sudo apt update
sudo apt install -y apache2
sudo systemctl start apache2
sudo systemctl enable apache2
step 9. Create NLB target group and don't forget to choose TCP port
step 10. Create Network Load Balancer
step 11. Copy the DNS name from network load balancer and open in the url
step 12. You will see the apache2 installed in the ec2 instance that comes throught the network load balancer.
Thanks for reading ...................................