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 the Apache webserver installed in it. I have already launched two instances (node-1 and Node-2) and installed the Apache webserver.
The node-1 instance has a website that contains the following text.
“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 the Classic load balancer and click the “Create” button to start. You will navigate to the 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.
On the next page, you can add a tag for your load balancer. After finishing it chooses to review and create a button.
Yes, we have successfully created My-Test-Loadbalancer.
Go back to the Load balancer window and click the “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 service.
Now, we have created an LB and confirmed nodes are joined.
AWS doesn’t provide a public IP address for the 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
To 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 purposes, 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 two name records 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 the load balancer access log to view the 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.