top of page

Tutorial blog to create an AWS Network Load Balancer

Learning Objectives: -

  1. Learn to create a target group.

  2. Learn to create a Network Load Balancer.

Step 1: In AWS Console go to EC2 Service. Create 2 Linux Web Servers in 2 different availability zones. In Advanced details, give the following code as given below. To know how to create Linux Web Servers refer to this blog.

First WebServer in Availability Zone 1a:


yum -y update

yum -y install httpd

chkconfig httpd on

service httpd start

echo "<html><h1>Hello! This is your First Web Server 1!</h1></html>" > /var/www/html/index.html

Second WebServer in Availability Zone 1b:


yum -y update

yum -y install httpd

chkconfig httpd on

service httpd start

echo "<html><h1>Hello! This is your Second Web Server 2!</h1></html>" > /var/www/html/index.html

Step 2: After creating two Web Server’s instances go to Load Balancers under Load Balancing Tab In the navigation pane, choose Target Groups.

  • Choose Create target group.

  • Keep the target type as instances.

  • For Target group name, enter a name for the new target group.

  • For Protocol, choose TCP, and for Port, choose 80.

  • For VPC, select the VPC that contains your instances.

  • For Health checks, keep the default settings.

  • Choose Next.

  • On the Register targets page, complete the following steps.

  • For Available instances, select your instances.

  • Keep the default port 80 and choose Include as pending below.

  • Choose Create target group.

Step 3: Go to Load Balancers under Load Balancing Tab. Click on create Create Load Balancer.

  • For Network Load Balancer, choose Create.

  • For Load balancer name, enter a name for your load balancer. For example, my-nlb.

  • For Scheme and IP address type, keep the default values.

  • For Network mapping, select the VPC that you used for your EC2 instances. For each Availability Zone that you used to launch your EC2 instances, select the Availability Zone and then select one public subnet for that Availability Zone.

  • For Security groups, we preselect the default security group for your VPC.

  • For Listeners and routing, keep the default protocol and port, and select the target group from the list.

  • Review your configuration and choose Create load balancer.

Step 4: Choose Target Groups. Select the newly created target group.

  • Choose Targets and verify that your instances are ready.

  • If the status of an instance is initial, it's probably because the instance is still in the process of being registered, or it has not passed the minimum number of health checks to be considered healthy.

  • After the status of at least one instance is healthy, you can test your load balancer.

Step 5: In the navigation pane, under Load Balancing, choose Load Balancers.

  • Select the name of the newly created load balancer to open its details page.

  • Copy the DNS name of the load balancer.

  • Paste the DNS name into the address field of an internet-connected web browser.

  • If everything is working, the browser displays the default page of your server.

  • Every time you refresh it, alternatively each web server is observed to work.

  • Now stop any one of the instances and then refresh the browser page of your output.

  • You will be able to see the output of one instance is unhealthy and therefore the output is not visible on the browser.

Note: Delete the Load Balancer and Target Groups and terminate the two instances, if no longer needed.

Network Load Balancer
Download PDF • 490KB

Was this document helpful? How can we make this document better. Please provide your insights. You can download PDF version for reference.

For your aws certification needs or for aws learning contact us.

Recent Posts

See All


easy steps to understand


Very Helpful


useful content ....


Very well explained..nice blog!


Janani G
Janani G
Jan 31

Very easy to understand

bottom of page