To create a step scaling policy for scale in for your Auto Scaling group, use one of the following methods:
Step 1: Create a CloudWatch alarm for the metric low threshold
Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/
. -
If necessary, change the Region. From the navigation bar, select the Region where your Auto Scaling group resides.
-
In the navigation pane, choose Alarms, All alarms and then choose Create alarm.
-
Choose Select metric.
-
On the All metrics tab, choose EC2, By Auto Scaling Group, and enter the Auto Scaling group's name in the search field. Then, select
CPUUtilization
and choose Select metric. The Specify metric and conditions page appears, showing a graph and other information about the metric. -
For Period, choose the evaluation period for the alarm, for example, 1 minute. When evaluating the alarm, each period is aggregated into one data point.
Note
A shorter period creates a more sensitive alarm.
-
Under Conditions, do the following:
-
For Threshold type, choose Static.
-
For Whenever
CPUUtilization
is, specify whether you want the value of the metric to be less than or less than or equal to the threshold to breach the alarm. Then, under than, enter the threshold value that you want to breach the alarm.Important
For an alarm to use with a scale in policy (metric low), make sure you do not choose greater than or greater than or equal to the threshold.
-
-
Under Additional configuration, do the following:
-
For Datapoints to alarm, enter the number of data points (evaluation periods) during which the metric value must meet the threshold conditions for the alarm. For example, two consecutive periods of 5 minutes would take 10 minutes to invoke the alarm state.
-
For Missing data treatment, choose Treat missing data as bad (breaching threshold). For more information, see Configuring how CloudWatch alarms treat missing data in the Amazon CloudWatch User Guide.
-
-
Choose Next.
The Configure actions page appears.
-
Under Notification, select an Amazon SNS topic to notify when the alarm is in
ALARM
state,OK
state, orINSUFFICIENT_DATA
state.To have the alarm send multiple notifications for the same alarm state or for different alarm states, choose Add notification.
To have the alarm not send notifications, choose Remove.
-
You can leave the other sections of the Configure actions page empty. Leaving the other sections empty creates an alarm without associating it to a scaling policy. You can then associate the alarm with a scaling policy from the Amazon EC2 Auto Scaling console.
-
Choose Next.
-
Enter a name (for example,
Step-Scaling-AlarmLow-RemoveCapacity
) and, optionally, a description for the alarm, and then choose Next. -
Choose Create alarm.
Use the following procedure to continue where you left off after creating your CloudWatch alarm.
Step 2: Create a step scaling policy for scale in
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
, and choose Auto Scaling Groups from the navigation pane. -
Select the check box next to your Auto Scaling group.
A split pane opens up in the bottom of the page.
-
Verify that the scaling limits are appropriately set. For example, if your group's desired capacity is already at its minimum, you need to specify a new minimum in order to scale in. For more information, see Set scaling limits for your Auto Scaling group.
-
On the Automatic scaling tab, in Dynamic scaling policies, choose Create dynamic scaling policy.
-
For Policy type, choose Step scaling, and then specify a name for the policy.
-
For CloudWatch alarm, choose your alarm. If you haven't already created an alarm, choose Create a CloudWatch alarm and complete step 4 through step 14 in the previous procedure to create an alarm.
-
Specify the change in the current group size that this policy will make when executed using Take the action. You can remove a specific number of instances or a percentage of the existing group size, or set the group to an exact size.
For example, to create a scale in policy that decreases the capacity of the group by two instances, choose
Remove
, enter2
in the next field, and then choosecapacity units
. By default, the upper bound for this step adjustment is the alarm threshold and the lower bound is negative (-) infinity. -
To add another step, choose Add step and then define the amount by which to scale and the lower and upper bounds of the step relative to the alarm threshold.
-
Choose Create.