AWS Project : Setting up an Application Load Balancer(ALB)  on EC2 with httpd running in it

AWS Project : Setting up an Application Load Balancer(ALB) on EC2 with httpd running in it

BY - GJS

Creating an EC2 instance with "httpd" running:

  1. Go to EC2 and select Launch Instance :

  2. Fill in the details. For example :

    Here we are selecting Amazon Linux. You can choose whatever you like.

    You can choose an already present key pair or make a new one.
    I chose my old key pair named "New-Nvirginia"

    You can set the traffic according to your needs.

  3. Now go to "User data" in "Advanced Details" and write the following command :

     #!/bin/bash
    
     yum update -y 
    
     yum install httpd -y
    
     systemctl start httpd
    
     systemctl enable httpd
    
     cd var/www/html/
    
     echo "This is your friend Gaurav Ji Srivastava. People call me GJS" > index.html
    

    Now click on Launch Instance

    Now copy the instance Public Address and paste it into the Browser :

Creating a Launch Template of your EC2 instance :

  1. Select your instance and click on "Actions", go to "Image and Templates" and select "Create template from instance" :

    Fill in the details and Click on "Create Launch Template" :

Creating an AutoScaling Group :

  1. Go to Auto Scaling and Select Auto Scaling Group :

  2. Give the name to the Auto Scaling Group and Select the Launch Template :

    Press Next and select the Availability Zones and Subnets :

    Press Next and Select the following :

    Select one more Availability zone and create a Target group :

    You can turn on Health Checks as you wish :

    Set the Desired, Minimum and Maximum Group Size :

    Set the scaling Policy :

    You can set the notifications if you want :

  3. Click on Create Auto Scaling Group :

    The Auto Scaling Group Gets automatically gets attached to the EC2 instance you created earlier.

    If you want to attach it to the other instances which are created from the above launch template then do the following :

    After your work is done, delete the Auto Scaling Group:

Thank you :

Dear readers,

I want to express my heartfelt gratitude for your continuous support and engagement with my blog. Your readership and valuable feedback have been instrumental in shaping the content and direction of my writing. Thank you for being a part of this journey and for inspiring me to keep sharing my thoughts and ideas. Your presence means the world to me, and I am truly grateful for your unwavering support.

Warmest regards, Gaurav Ji Srivastava