Application Load Balancer Setup for EC2

Tasks

  • Set up an Application Load Balancer named xfusion-alb.

  • Create a target group named xfusion-tg.

  • Create a security group named xfusion-sg to open port 80 for the public.

  • Attach this security group to the ALB.

  • Configure the ALB to route traffic on port 80 to port 80 of the xfusion-ec2 instance.

  • Make necessary changes to the default security group attached to the EC2 instance if needed.

Steps

  1. Checkout the ec2 → instance (xfusion-ec2)

  2. Select load balancer.

  3. Create Application Load Balancer

    EC2 → Load balancers → Compare and select load balancer type

  4. Pick subnet from our ec2

  5. Name the load balancer.

  6. Select availability zone, atleast two; one from our ec2 subnet and another any of remaining subnet.

  7. Create target group.

    EC2 → Target groups → Create target group

    • Choose a target type → Instances

  8. Name the group, xfusion-tg.

  9. Select Next

  10. Successfully created the target group: xfusion-tg.

  11. Now, select a target group.

  12. Successfully created load balancer: xfusion-alb

  13. Security group (sg-097258aa3bafd5395 | xfusion-sg) was created successfully

    EC2 → Security Groups → sg-097258aa3bafd5395 - xfusion-sg

  14. Let’s config security group on instances to for alb.

    EC2 → Security Groups → sg-05a1bf9fe7738fdb5 - default → Edit inbound rules

  15. Inbound security group rules successfully modified on security group (sg-05a1bf9fe7738fdb5 | default)

  16. Register targets

  17. EC2 → Target groups → xfusion-tg → Register targets

  18. Register pending targets

  19. One target registered successfully to xfusion-tg. And health status is healthy

  20. We have load balancer now.

  21. Now checkout the dns name.

Boom!! We finally did this: Setting Up an Application Load Balancer for an EC2 Instance. :)

#happylearning #loadbalancer #alb