Auto Scaling

What Is Auto Scaling?

  1. Auto Scaling helps us in ensuring that we have the correct number of Amazon Elastic compute cloud (EC2) instances available to handle the load for our application dynamically. We can create collections of EC2 instances, called Auto Scaling groups.
  2. We can specify the minimum number of instances in each Auto Scaling group, and Auto Scaling ensures that our group never goes below that size, which we have defined. We can specify the maximum number of instances in each Auto Scaling group, and Auto Scaling ensures that our group never goes above this size, which we have defined.
  3. If we specify the desired capacity, either when we create the group or at any time thereafter, whenever it is required. Auto Scaling ensures us that our group has this many instances. If we specify scaling policies, then Auto Scaling can launch or terminate instances as demand on our application increases or decreases based on the threshold we specified.

Note: it is not a standalone service while it is a part of EC2 Service.

Architecture of Auto Scaling
auto scaling

Benefits of Auto Scaling

Adding Auto Scaling to our application architecture is a way to maximize the benefits of the AWS cloud. When we use Auto Scaling, our applications gain the following benefits:

  1. Better fault tolerance: Auto Scaling can easily detect when an instance is unhealthy, terminate it, and launch a new instance to replace it. We can also configure Auto Scaling to use multiple Availability Zones too. If one the Availability Zone becomes unavailable, Auto Scaling will launch instances in another zone to compensate.
  2. Better availability: Auto Scaling can help us in ensuring that our application always has the right amount of capacity to handle the current traffic demands.
  3. Better cost management: Auto Scaling can dynamically increase as well as decrease capacity as we needed. Because we pay for the EC2 instances we use as we already knew that it works on a pay-as-you-go model, we save money by launching instances when they are actually needed and terminating them when they are not needed.

Steps to create Auto Scaling:

Step 1: Create a Launch Configuration.

A launch configuration specifies the type of EC2 instances that Auto Scaling creates for us. We can create the launch configuration by including information such as the Amazon Machine Image (AMI) ID to use for launching the EC2 instances, the instance type, key pairs, security groups (SG), and block device mappings, among other configuration settings.

So that newly created instance already has installed each and everything which we actually required from the newly created instance and that is only possible due to that AMI by which we are choosing for launching the configuration.

Note: please make sure your AMI must have each and everything which is required to be in a newly created instance.

Log in to the AWS console. Navigate to Services->EC2 and then click on Launch Configuration from Auto Scaling.


Select the Amazon Machine Image which you have already created from your instance, from My AMI’s section:


Select the type of the instance based on your requirement. Here we are choosing t2.micro as it comes under free tier access.


Provide the name of the launch configuration.


Add the storage and Security Groups. Then go for review.

Step 2: Create an Auto Scaling Group

An Auto Scaling group is the collection of Amazon Elastic Compute Cloud (EC2) instances, and the core of the Auto Scaling service. We can create an Auto Scaling group by specifying the launch configuration which we want to use for launching the new instances and the number of instances your group must maintain at all times. We also specify the Availability Zone in which we want the instances to be launched.

Navigate to Services. Select EC2 and click on Auto Scaling. Choose Launch Configuration and then select an existing launch configuration.


Provide the name of your auto scaling group. Choose VPC and Subnet in which your instances will be launched


We need to specify the minimum and the maximum number of instances over this group using the row that begins with “Scale between” for dynamic behavior of instance creation as per the application need.


Create two alarms. The first one is to increase the group and the second is to decrease it.



Configure to add one instance for the first alarm, and to remove one for the second.


Now review the group and click on Create


The creation will take a few seconds, and new instances will be launched soon.


Subscribe Now