Deploying an Application Load Balancer in AWS


  • 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.
    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:

  1. From EC2 select “Load Balancers”
  2. Create Load Balancer and under the Load Balancer Type Choose Application Load Balancer
  3. “Create”
  4. Basic Configuration:
  5. Provide the “Load balancer name”
  6. Select “Internet-facing” and “IPv4”
  7. Network mapping:
  8. Select the “VPC” and the “Availability Zone” where your EC2 instances are deployed.
  9. Security groups:
  10. Select the “Security Group”
  11. Listeners and routing:
  12. Select the “Protocol” HTTP and “Port” 80
  13. “Create target group” will open a new tab.
  14. Basic configuration:
  15. “Choose a target type” should be Instances.
  16. Provide “Target group name”
  17. Protocol : Port = HTTP : 80
  18. “IP address type” IPv4
  19. Select the “VPC” where EC2 instances were deployed.
  20. “Protocol version” HTTP1
  21. Health checks:
  22. “Health check protocol” HTTP
  23. “Health check path” /index.html
  24. “Next”
  25. Register targets:
  26. Choose the EC2 instances under the Available instances
  27. “Ports for the selected instances” 80
  28. “Include as pending below”
  29. Select “Create target group”
  30. Go to the previous tab under the “Listeners and routing:”
  31. Hit refresh for the Select a target group
  32. From the drop-down select the Target group just created.
  33. Have a look at the Summary:
  34. Select “Create load balancer”
  35. The load balancer will be provisioning
  36. When the “Status” is Active you can use the load balancer.
  37. Select the load balancer copy the DNS Name and paste it on a new tab.
  38. If the page shows “The Apache Server!” the ALB is working fine.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.