Configuring AWS Scaling Policy inside an Auto Scaling Group

Posted by

We’ve all been there where we need to setup an auto scaling policy for our auto scaling groups.  I find policies a great way to control the spin up and spin down of new resources based on workload requirements. 

I high recommend you go skim over the dynamic scaling documentation on AWS for all your options.

How to apply a new policy to your ASG:

We need to create our first scaling policy

There are different policy types but in my example I will be working with target scaling

Pick something as simple as CPU

Target value could be anything you want and I am using 45 for example but it could be whatever your company chooses.

Warm up is how long does instances need to warm up before including in the metric – 300 seconds is default

Confirm the policy has been created and all the inputs are correct

I changed desired capacity to 2 for the ASG, which should have a second instance created but the CPU utilization will be near zero so the scaling policy should then remove the second instance following the warm up timer

As you can see the ASG attempted to spin up a second instance

I now have two running instances that are apart of my ASG

The policy realizes the CPU utilization on the second instance does not meet the applied policy so it is beginning the termination process after 300 seconds.

Summary:
Policies are a great way to automate how groups of different resources respond to changes in demand.  This allows for you to optimize availability, code, or balance your group.  As always, I hope y’all found this useful.

Leave a Reply