PetaBytz

Amazon EC2: Auto Scaling

Auto Scaling Components

1. Groups

They are the logical groups which contain the collection of EC2 instances which are having similar characteristics for scaling and management purpose. When you create a group, we can specify its minimum, maximum, and, desired number of EC2 instances.

2. Launch Configuration

It is a template used by the auto-scaling group to launch EC2 instances. We can specify information such as the AMI ID, instance type, key pair, and security groups for your instances while creating the launch configuration.

3. Scaling Plan

The scaling plan informs Auto Scaling how and when to scale. Amazon EC2 auto-scaling provides the following ways for you to scale the auto scaling group:

we need to create an AMI of our application which is running on our EC2 instance.

Launch Configuration:

Go to EC2 console and click on Launch Configuration from Auto Scaling

2. Choose AMI, select the Amazon Machine Image from My AMIs tab, which was used to create the image for your web application.

3. Then, select the instances type which is suitable for your web application and click Next: Configure details.

4. On Configure details, name the launch configuration, you can assign if any specific IAM role is assigned for your web application, and also you can enable the detailed monitoring.

5. After that, Add the storage and Security Groups then go for the review.
Note: Open the required ports for your application to run.

6. Click on Create launch configuration and choose the existing key pair or create a new key pair

  • Setup: Auto Scaling Group:
  1. From EC2 console click on Auto Scaling Group which is below the launch configuration. Then click on create the auto-scaling group.
  2. From the Autoscaling Group page, you can create either using a launch configuration or Launch Template. Here I have created using Launch Configuration. You can create a new Launch Configuration from this page also. Since you had already created the launch configuration, you can go for creating the auto-scaling group by using “Use an existing launch configuration”.
  3.  After clicking on the next step, you can configure group name, group initial size, and VPC and subnets. Also, you can configure load balance with an auto-scaling group by clicking Advanced Details.

After that click on next to configure scaling policies

4. On the scaling policy page, you can specify the minimum and the maximum number of instance in this group. Here you can use target tracking policy to configure the scaling policies. In metric type, you can specify such as CPU utilization and Network In or Out and also you can give the target value as well. Depending on the target value the scaling policy will work. You can also disable scale-in from here.

You can also use Step and simple scaling policies.

It works based on the alarm, so first, create the alarm by clicking on ‘add new alarm’.

Here the alarm created is based on CPU utilization above 65%. If CPU utilization crosses 65% the auto-scaling launches new instances based on the step action.

You can specify more step actions based on your load, but in the simple policy, you can’t categorize depending on the percentage of CPU utilization. Also, you need to configure scale-in policies once the traffic becomes low, as it reduces the billing.

5. Next click on ‘Next: Configure Notification’ to get the notification based on the launch, terminate, and fail, etc. to your mail ID, and enter the tag and click on ‘Create auto-scaling group’

Leave a Reply

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