In real-world environments, website traffic can spike unexpectedly and cause overload if the application runs on only a single web server. AWS Application Load Balancer (ALB) is designed to distribute incoming traffic, reduce downtime, and help ensure high availability for the system. In this article, I will provide a simple and effective guide to deploying an ALB for EC2 web servers.
Deployment Architecture

In the above architecture, users on the Internet send requests to access the website. The requests are received by the Application Load Balancer at the load balancer layer. The ALB performs health checks and distributes requests across the Target Group, which contains EC2 web servers deployed across multiple Availability Zones. Thanks to this multi-AZ architecture, the system remains stable and ensures High Availability even if an EC2 instance or an AZ encounters a failure.
Create a Security Group (SG)
1. Create the ALB Security Group
Navigate to EC2 > Security Groups > Create Security Group.
-
Security group name:
lu-sg-alb -
Description:
Allow http from internet -
Tag (Key:
Name, Value:lu-sg-alb)

Configure inbound rules to allow any IP address to access the Load Balancer via HTTP; configure the outbound rules similarly.

2. Create the web server Security Group
-
Security group name:
lu-sg-web-server -
Description:
Allow http from ALB -
Tag (Key:
Name, Value:lu-sg-web-server)
For the inbound rules, allow only traffic from the ALB to the EC2 instance by selecting the ALB Security Group created earlier. Other connections cannot access the EC2 instance directly and must go through the ALB.

Successfully created 2 SG.

Create EC2
Go to EC2 > Instances > Launch Instances.
Here, we will create at least 2 EC2 instances.
For the first EC2 instance:
- Name:
lu-ec2-web-server-01 - OS:
Default (Amazon Linux 2023) - Instance type:
Default (t3.micro) - Key pair: Create a new key pair with the name:
d-key-SAA-common - Network Settings:
- VPC:
Default - Subnet:
us-east-1a - Auto-assign public IP:
Enable - Select an existing security group:
lu-sg-web-server
- VPC:
- Advanced details (User data)
#!/bin/bash yum update -y yum install -y httpd.x86_64 systemctl start httpd.service systemctl enable httpd.service echo “Hello World from $(hostname -f)” > /var/www/html/index.html

On the second EC2 instance:
- Name:
lu-ec2-web-server-02
Follow the same steps, but change the AZ to us-east-1b.
Once created, the two EC2 instances will be in two different AZs, as shown below.

Create Target Group
Go to EC2 > Target Group > Create taget group
- Choose a target type:
Instances - Target group name:
tg-web-server - Protocol:
HTTP - Port:
80 - VPC: Select the default VPC
- Tag: Key:
NameValue:tg-web-server - Health check path: the path that the ALB periodically sends a request to the target (EC2/ECS/EKS/IP) to verify whether the backend service is still running. Usually, if the HTTP Response Code returned is 200-399 (default), the target is considered
healthy. Otherwise,unhealthythe ALB stops routing traffic to the target.


Register targets: add 2 newly created and selected instances Include as pending below.

Review the configuration and create target group.

Create ELB
Go to EC2 > Load balancers > Create Application Load Balancer.
- Select Create Application Load Balancer
- Load balancer name:
lu-alb-web-alb - Scheme:
-
Internet-facingPublic: AWS assigns a Public IP address (per AZ) to the ALB and provides a public DNS name. This allows clients from the Internet to access it: Client → Internet → ALB → Target - Internal: used only within the VPC
-
- IP address type:
IPv4

Network mapping
- VPC: Select
default VPC - Mappings: Select
us-east-1aandus-east-1bcorresponding to the AZs of the instances just created. - Security groups:
lu-sg-alb

Listeners and routing
- Protocol:
HTTP - Port:
80 - Default action: Forward
Forward to taget groups????? forward traffic from ALB to the backend in the Target group - Target group:
tg-web-server

After creating the ALB, wait one minute for it to transition to the Active state.

At this point, navigate to the previously created Target Group > Health status, where you will see the Instances in the Healthy.

Check the ALB
Return to the ALB interface and copy the DNS name of the newly created ALB.

Access it in a browser and reload the page several times to verify load balancing across the ALB you created.

You can see that when you refresh the ALB, it sends requests to two different instances.
Clean up
To delete this lab, follow these steps in order:
- Terminated EC2
- Delete ALB
- Delete Taget Group
- Delete SG
- Delete SG
Conclusion
Through this article, you have learned how to deploy an Application Load Balancer to distribute traffic across EC2 web servers on AWS, as well as understand the traffic flow and benefits of a multi-AZ architecture. Using an ALB correctly helps keep the system stable, highly available, and easy to scale as access demand increases. This is a suitable foundational architecture for most websites and web applications in production environments.