Wednesday, March 16, 2022

AWS - Autoscaling and Launch Configuration

AWS Auto Scaling monitors your applications and automatically adjusts capacity to maintain steady, predictable performance at the lowest possible cost. Using AWS Auto Scaling, it's easy to setup application scaling for multiple resources across multiple services in minutes.

To Create Launch Configuration

Step 1: Create an EC2 instance Amazon Linux Image and Install apache (httpd)  and an index.html with some content.

Step 2: Create an AMI of the above EC2 instance. for example I am creating an apacheimg

Step 3: Autoscaling--> Launch Configuration

Step 4: Define properties of Launch Configuration

  •       Name: LC1
  •       AMI: apacheimg
  •       Instance Type: t2.micro
  •       Security Group: New Security Group and Add the HTTP Rule
  •       Key Pair : Select Existing key pair

Click on Create Launch Configuration button

To Create Autoscaling group with Launch Configuration

Step 1 : Select Auto Scaling ---> Auto Scaling Group

Step 2: Click on Create Auto Scaling Group button

Step 3: Define the Auto Scaling Group properties

  •           Name:  ASG1
  •           Click on Swicth To Launch Configuration.
  •           Select Launch Configuration: LC1
  •           Click on Next Button
  •            VPC : default
  •           AZs : I am selecting all.
  •           Click on Next button
  •           LoadBalancing: No LoadBalancer
  •           Click on Next 
  •           Desire Capcity: 2
  •           Min: 1
  •            Max: 3
  •          Select option Target Tracking Policy
  •          Metric Type Average Cpu Utilization: 50
  •          Click on Next
  •          Add Notification : Not Change
  •          Add Tags : No change
  •         Review and Click on Create Auto scaling group button

Step 4: Check in EC2 instances that 2 instances must be in the running state because we have defined Desire state=2.

Step 5: Once you finish this lab then you can delete the AutoScaling Group and you will observe that EC2 instances related to ASG is also deleted .

Experiments: Before Deletion

1. Check all the Ec2 instances are running with the same SG as you defined during Launch Configuration.

2. Access the default page of each EC2 instance and it should give the same output.

3. Try to delete Launch Configuration which in use.


Post a Comment