In this article, we will learn how to create an AWS Classic Loadbalancer and it’s configuration. For this, we will use two ec2 instances with Apache web server installed in it. I have already launched two instances (node-1 and Node-2) and installed Apache web server.
The node-1 instance has a website which contains the following text in.
“Website loading from Node-1” and
The Node-2 instance has a website which contains the following test
“Website loading from Node-2” so we can understand each time from which node Loadbalancer serving the content.
Configure classic Loadbalancer:-
Login to AWS console and Navigate to EC2 and select Loadbalancer ( Present left the side of the dashboard).
Choose Classic load balancer and click “Create” button to start. You will navigate to below window, here you have to configure your Loadbalancer such as Name, Listener etc.
For Available subnets, select at least one available public subnet using its add icon. The subnet is moved under Selected subnets. To improve the availability of your load balancer, select more than one public subnet.
Next, configure Security settings.
Once it is done configure health check.
Here I have used index.html as my ping path. So the index.html file is not present or corrupted or has permission issue then Loadbalancer will route traffic to the available healthy nodes. Also, if the httpd process failed on one node also the traffic will be moved to the healthy node.
Click next to register ec2 instances with our load balancer.
In the next page, you can add a tag for your load balancer. After finishing it choose to review and create a button.
Yes, we have successfully created My-Test-Loadbalancer.
Go back to Load balancer window and click “Instances” tab to see the instance present under our LB. Here the status may show “out of service”. It will take a few seconds to register the instance with the new Load balancer.
Once it is complete the registration with LB the Status will change to InService.
Now, we have created an LB and confirmed nodes are joined.
AWS doesn’t provide public IP address for Load balancer but provides public DNS, this information can be present in the “Description” tab.
Here you can see the DNS name. Copy this url and access in a browser, you can see the site is loading from the Node-1
Do refresh and can see the site is loading from Node-2. We can confirm that our load balancer is distributing the request to underlying nodes.
Next, how we can use this load balancer for our website or application for this we need to create a CANAME record. For test purpose, I have created a domain called “test-lb.techiescorner.in” to access my website. Then we have to point out our domain to the Load Balancer. I created below two cname record at my DNS server.
So, when you access the url lb-test.techiescorner.in it will redirect to our LB url (
Yes, we successfully pointed our website or application to the load balancer.
Next, we will configure Load balancer access log to view traffic received. For this, in the details tab -> Attributes -> Click on Configure Access Log
Create a new S3 bucket or use an existing S3 bucket, so the logs will be written to the S3 bucket.
Yes, we have successfully configured AWS classic load balancer.