Bonjour πŸ˜›

If you own a website and fortunately it’s leading in the market, you might have encountered excessive traffic on it. Happy!! But it might hang your server or lead to the shutdown of the services. Not now?

Don’t hustle, we have AWS by our side for easing down our tasks. Today, we’ll be figuring out one of the most awesome Service of AWS, ELASTIC LOAD BALANCING, and how we can implement it using AWS EC2.

What is Load Balancer?

A load balancer is used when you want to divide the traffic on your server so that it does not crash. It balances the load on the backend between two or more servers such that there is no effect on the front end. The process remains smooth for the user and he/she cannot tell that there is more than one server present on the back end.

There are three types of Elastic Load Balancers available in AWS:

  • Application Load Balancer
  • Network Load Balancer
  • Classic Load Balancer

Classic Load Balancers are intended for applications that were built within EC2-Classic Network. In this tutorial, we will be working with the Classic Load Balancer. Let’s get started then.


i) Launch two EC2 instances as described in the last tutorial.

ii) Host static html web pages on both the instances with the same file name. For example – index.html.

Check out the last blog to fulfill the above steps: Web-Page-Deployment-on-AWS-EC2

Photo from Code Seekers

iii) Make sure that the content of both the web pages is different so that we can differentiate between them later. For example-

        <title>Data Stats</title>
        <h1><i><font color="brown">WELCOME</font></i></h1>
        We are happy to have you on Data-Stats.
        PAGE 1
        <title>Data Stats</title>
        <h1><i><font color="brown">WELCOME</font></i></h1>
        We are happy to have you on Data-Stats.
        PAGE 2

We have our EC2 Instances ready. :))

How to create a Classic Load Balancer?

a) Open the Amazon EC2 console through AWS dashboard.

b) Under LOAD BALANCING, choose Load Balancers.

c) Choose Create Load Balancer.

d) For Select load balancer type, choose Classic Load Balancer. For Load Balancer name, type a name for your load balancer. It should have a unique name.

e) Select the default VPC and to choose the subnets for your load balancer, select Enable advanced VPC configuration.

(Note: If you have chosen the default VPC but did not select Enable advanced VPC configuration, you will not be able to see the user interface to select subnets.)

Select the subnets from Available subnets which are the same as of your availability zone of EC2 Instances.

f) Choose Next: Assign Security Groups.

Assign security group to the load balancer

Step-1 : On the Assign Security Groups page, select create a new security group.

Step-2: Type a name and description for your security group, or leave the default name and description. This new security group contains a rule that defines the traffic that you wish to allow to your load balancer.

Step 3: Choose Next: Configure Security checks

We have nothing to configure here.

Step 4: Choose Next: Configure Health checks

To configure health checks

Step 1: On the Configure Health Check page, select a ping protocol and ping port. Your EC2 instances must accept the specified traffic on the specified ping port.

Step 2: For Ping Path, replace the default value with β€œ/index.html” the name of your file. Keep the other settings at their default values.

Step 3: Choose Next: Add EC2 Instances. Your load balancer distributes traffic between the instances that are registered to it. You can select EC2 instances in a single Availability Zone or multiple Availability Zones within the same region as the load balancer.

To register EC2 instances with the load balancer

Step 1: On the Add EC2 Instances page, select the instances to register with your load balancer.

Step 2: Leave cross-zone load balancing and connection draining enabled.

Step 3: Choose Next: Add Tags.

To tag the load balancer

This step is optional. You can tag your load balancer, or continue to the next step.

On the Add Tags page, specify a key and a value for the tag. To add another tag, choose Create Tag and specify a key and a value for the tag.

Choose Next: Review and Create.

To Review and Create the load balancer

Before you create the load balancer, review the settings that you selected. After creating the load balancer, you can verify that it’s sending traffic to your EC2 instances.

Step 1: On the Review page, check your settings and edit if you need to make any changes. Choose to Create.

Step 2: After you are notified that your load balancer was created, choose Close. Select your load balancer.

Step 3: On the Description tab, check the Status row. If it indicates that some of your instances are not in service, it is probably because they are still in the registration process.

Finally Load Balancer is created!! We are so close to win the battle. Here, comes the last task. πŸ™‚

Test our Load Balancer

Paste the DNS name of your Load balancer in a new tab.

Refresh the page and you will be able to see the load being distributed between the two servers. That is happening because of the load balancer that you just created!!

Fundo!! It worked for me. Exercise this amazing service and let us know if it worked for you also. We would be happy to hear back from you.

Thanks for reading.

– Rishita Anand Sachdeva

1 Comment

Sherry · June 25, 2020 at 8:05 am

I could not resist commenting. Well written! I have been surfing online more than 3 hours these days,
yet I never discovered any attention-grabbing article like yours.
It’s lovely worth enough for me. In my view, if
all webmasters and bloggers made excellent content as you probably did,
the net will be a lot more useful than ever before. Hi, I do believe this is an excellent site.
I stumbledupon it πŸ˜‰ I am going to return once again since i have
saved as a favorite it. Money and freedom is the greatest way to change, may you be rich and continue to guide other people.

Leave a Reply

Your email address will not be published. Required fields are marked *

Insert math as
Additional settings
Formula color
Text color
Type math using LaTeX
Nothing to preview