Deploying an Application Load Balancer in AWS
Pre-requisites:
- Two EC2 instances deployed in two different availability zones to work as the web servers.
- Script to include in the EC2 user data section to deploy the Apache web server.
#!/bin/bash
yum update -y
yum install httpd -y
echo "<html><body><h1>The Apache Server!</h1></body></html>" >/var/www/html/index.html
systemctl start httpd
systemctl enable httpd
Create the Application Load Balancer:
- From EC2 select "Load Balancers"
- Create Load Balancer and under the Load Balancer Type Choose Application Load Balancer
- "Create"
- Basic Configuration:
- Provide the "Load balancer name"
- Select "Internet-facing" and "IPv4"
- Network mapping:
- Select the "VPC" and the "Availability Zone" where your EC2 instances are deployed.
- Security groups:
- Select the "Security Group"
- Listeners and routing:
- Select the "Protocol" HTTP and "Port" 80
- "Create target group" will open a new tab.
- Basic configuration:
- "Choose a target type" should be Instances.
- Provide "Target group name"
- Protocol : Port = HTTP : 80
- "IP address type" IPv4
- Select the "VPC" where EC2 instances were deployed.
- "Protocol version" HTTP1
- Health checks:
- "Health check protocol" HTTP
- "Health check path" /index.html
- "Next"
- Register targets:
- Choose the EC2 instances under the Available instances
- "Ports for the selected instances" 80
- "Include as pending below"
- Select "Create target group"
- Go to the previous tab under the "Listeners and routing:"
- Hit refresh for the Select a target group
- From the drop-down select the Target group just created.
- Have a look at the Summary:
- Select "Create load balancer"
- The load balancer will be provisioning
- When the "Status" is Active you can use the load balancer.
- Select the load balancer copy the DNS Name and paste it on a new tab.
- If the page shows "The Apache Server!" the ALB is working fine.



Comments
Post a Comment