How We Can Use Load Balancer in AWS.

How We Can Use Load Balancer in AWS.

Load Balancer :- Load Balancer is a AWS Service Which is Use For Distribute Traffic Equally Between Two or More Servers.

Basically there are Three Types of Load Balancer in AWS.

  • Application Load Balancer (HTTP, HTTPS)
  • Network Load Balancer (TCP , UDP , TLS)
  • Gateway Load Balancer

Here we are using Application Load Balancer.

Here we Go...

Steps :-

  • first we need two EC2 instance so create two RedHat EC2 Machine and connect to the machines.
  • now install Apache2 server on both EC2 machine.
sudo yum install httpd -y
cd /var/www/html
echo "hello from web server 1" > index.html
sudo service apache2 restart
  • run all commands in both server.
  • now check web server is running or not copy EC2 dns URL and paste in browser.

Now Let's Create Target Group.

  • search Target Group in EC2 Dashboard and click on create target group.
  • now it will ask for Choose a target type select Instances and then give a target group name and leave all setting default simply click on next.
  • on next screen select your two instance which you are create previously so click on Include as pending below and click on create target group.
  • now you target group is created.

Now Let's Setup Load Balancer.

  • now go to the Load Balancer and click on create load balancer.
  • now select Application Load Balancer -> click on create.
  • give a name to you load balancer and select two region in Mapping section then select you security group and select you target group.
  • and then click on create load balancer.
  • now your load balancer is created.
  • and wait for 5-7 minute and then copy load balancer DNS name and paste on browser. that's it ...

You create Load Balancer.

Did you find this article valuable?

Support Sahil Dholpuria by becoming a sponsor. Any amount is appreciated!