🚀 Deploying a High-Availability Web App on AWS with EC2 and an Application Load Balancer
Samson Yekini

Samson Yekini @samsyne_yekeen

About: Cloud and DevOps engineer, skilled in SRE, AWS, azure , Digital Ocean, GCP, CI/CD, Docker, Kubernetes and Terraform. Having a passion to automate infrastructure to optimize and efficient role in SDLC.

Location:
Lagos, Nigeria
Joined:
Dec 2, 2024

🚀 Deploying a High-Availability Web App on AWS with EC2 and an Application Load Balancer

Publish Date: Aug 23
0 0

🎯 Objectives
Deploy 2 instances with different AZ
Install basic website on each instances
Create an Application Loadbalancer
Register both EC2 under the ALB

🔧 Prerequisites

Before you start, make sure you have:
An AWS account
Basic knowledge of EC2 instances
An Amazon Linux 2 AMI
An existing key pair & security group
🖥️ Step 1: Launch an EC2 Instance
(creating 2 instances)

Go to EC2 Dashboard → Launch Instance
Select Amazon Linux 2 AMI
Choose an instance type (I started with t3.micro)
Configure security group (allow HTTP (80), SSH (22), and HTTPS (443) if needed)
Launch and connect via SSH

*we hit on aws ec2 *

creating the instances

go to the network to change the subnet to 1a
Network

Then launch

*Open another ec2 with the same way we can call it instance2 or webserver2
*

Instance2

note we change network subnet in instance2 setup to 1b
subnet1b

Ensure the AZ are not the same

AZ view

Then launched

*Already 2 intances running then we open our ClI (termus, gitbash or any goodone)
lets set both instance up in our Cli

For instance 1

Intsnce1login

Run our apache commands
sudo yum update -y
sudo yum install -y httpd
sudo systemctl start htppd
sudo systemctl enable httpd
apache install

lets test the server

apache1

we do the same setup on another Cli for instance2 apache2

instance2

instance2

installing Apache2

apache2

test apache2

Apache2

Lets create our Application Load Balance
loadbalance > Targetgroup > create target group

Tg

select the instances

select the instances

targetcreated

go to Loadbalancer > create Loadbalacer > create ALb

craetn lb

then we opt in for application Lb

apk lb

Select the same Av zones in subnets of instance
Lb subnets

ADD listener (the previous Tg)

listner

LB Created
lb created

🌐 Step 4: Test the Load Balancer

Copy the DNS name of your ALB and open it in the browser:

lb dns

Or test using curl:

curl http://localhost
curl http://
curl http://

✅ Conclusion
We have successfully:
Launched two EC2 instances in different AZs
Installed Apache web servers
Configured an Application Load Balancer
Distributed traffic between both servers
This setup improves high availability and fault tolerance for your application 🚀

Comments 0 total

    Add comment