AWS Elastic Load Balancer
AWS Elastic Load Balancer (ELB) – Step-by-Step Guide
Elastic Load Balancer (ELB) is an AWS service that automatically distributes incoming application traffic across multiple EC2 instances. It improves application availability, fault tolerance, and scalability by spreading traffic across different Availability Zones.
Step 1: Create the First EC2 Instance
Create the first EC2 instance as usual.
While creating the instance, make sure to configure the following:
-
Name: Server_01
-
Key Pair: Select or create a key pair
-
Security Group: Allow required ports
-
Availability Zone: Select an Availability Zone
-
Application Setup: Configure your application in Advanced Details (if needed)
Step 2: Create the Second EC2 Instance with Security Group
Create a second EC2 instance and configure a new Security Group.
Inbound Rules:
-
HTTP – Port 80 – Source:
0.0.0.0/0 -
HTTPS – Port 443 – Source:
0.0.0.0/0 -
SSH – Port 22 – Source: Your IP
Important Points:
-
Edit the Network Settings
-
Select a different Availability Zone from Server_01
-
Both servers must be in the same AWS region
Name this instance:
-
Server_02
This setup ensures high availability across Availability Zones.
Step 3: Verify Availability Zones
At this stage:
-
Server_01 is in Availability Zone A
-
Server_02 is in Availability Zone B
Both instances are in the same region but different Availability Zones, which is essential for fault tolerance.
Step 4: Create a Target Group
-
Go to EC2 → Target Groups
-
Click Create target group
-
Choose:
-
Target type: Instance
-
Protocol: HTTP
-
Port: 80
-
-
Provide a name (example:
web-target-group) -
Register targets:
-
Select Server_01 and Server_02
-
Click Include as pending
-
Create the target group
-
Ensure the instances show Healthy status.
Step 5: Create the Load Balancer
-
Go to EC2 → Load Balancers
-
Click Create Load Balancer
-
Select Application Load Balancer
-
Configure:
-
Load Balancer name
-
Scheme: Internet-facing
-
IP address type: IPv4
-
-
Select multiple subnets (Availability Zones)
-
Select the Security Group allowing HTTP/HTTPS traffic
-
Configure the listener:
-
HTTP (80) → Forward to the target group
-
-
Create the Load Balancer
AWS will now create a Load Balancer with two backend servers.
Step 6: Access the Application Using Load Balancer
Once the Load Balancer is active, copy the DNS name provided by AWS:
Use this DNS name in the browser instead of individual server IPs.
Step 7: Scaling – Adding a Third Server
When traffic increases, a new server can be added easily.
Create Server_03:
-
Launch a new EC2 instance
-
Choose a new Availability Zone
-
Use the same application and Security Group
Add Server_03 to Target Group:
-
Go to Target Groups
-
Select the existing target group
-
Click Register targets
-
Select Server_03
-
Include as pending and save
Update Load Balancer Subnets:
-
Go to Load Balancer → Edit subnets
-
Add the subnet of Server_03’s Availability Zone
Once health checks pass, Server_03 will start receiving traffic automatically.
Conclusion
AWS Elastic Load Balancer distributes traffic across multiple EC2 instances located in different Availability Zones. This improves application availability, ensures fault tolerance, and allows seamless scaling as traffic increases.
Using ELB is a best practice for building highly available and scalable applications on AWS.
Date : 17Dec2025
Comments
Post a Comment