"Deploying Web Servers Behind a Load Balancer on AWS "


Project-01
In this post, I'll walk you through how I deployed two EC2 instances behind an AWS Load Balancer to demonstrate high availability and scalability. This setup is commonly used in production environments to ensure uptime and performance.
Project Overview
Deployed two EC2 instances on AWS, each running on a simple Apache web server with custom HTML.
Configured the Application Load Balancer to distribute the traffic between them.
Verified successful load balancing by accessing ALB DNS and observing alternative responses.
The setup ensures high availability and basic scalability for web traffic.
Pre-requisite
An AWS free tier account.
Basic knowledge of Linux command line.
Securing group allowing HTTP (port 80) access.
Apache (httpd) installed on both EC2 instances.
Let's get started--->
Step 1: Setup two EC2 instances using Amazon Linux 2 in the same VPC.
Step 2: Connect each instance and write these commands.
sudo yum update
sudo yum install httpd -y
sudo systemctl start httpd
cd /var/www/html
sudo vim index.html
Step 3: Verify that each server is running properly with its specific IP addresses over HTTP.
Step 4: Setting up the Target Groups for the Load Balancer.
Step 5: Configured the Load Balancer in front of the target groups.
Step 6: Checking the health status of Target Group (It should be Healthy).
Step 7: Access the Application Load Balancer using its DNS name in our browser.
Load Balancer is successfully distributing traffic between the two EC2 instances, and everything is working as expected.
You can now safely terminate the EC2 instances and delete the load balancer and target groups to avoid the ongoing charges.
Done!
👍🏼✔️✅☑️🏁
Summary:
In this project, I deployed two EC2 instances on AWS, each running a simple Apache web server with a unique HTML page. I then configured the Application Load Balancer to distribute incoming HTTP traffic evenly between the instances using a target group. Health checks ensured both servers were running properly, and setup was verified through ALB DNS. After the successful testing, resources were safely terminated to avoid unnecessary charges.
I hope you learned something new from this blog today!
Happy Learning !!
This is my first blog…Stay tuned for my next blog. I will keep sharing my learnings and knowledge here with you.
Thank you,
Abhishek Jadhav
Subscribe to my newsletter
Read articles from Abhishek Jadhav directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
