Simple scaling policies
The following examples show how you can use CLI commands to create simple scaling policies. They remain in this document as a reference for any customers who want to use them, but we recommend that you use target tracking or step scaling policies instead.
Similar to step scaling policies, simple scaling policies require you to create CloudWatch alarms for your scaling policies. In the policies that you create, you must also define whether to add or remove instances, and how many, or set the group to an exact size.
One of the main differences between step scaling policies and simple scaling policies is the step adjustments that you get with step scaling policies. With step scaling, you can make bigger or smaller changes to the size of the group based on the step adjustments that you specify.
A simple scaling policy must also wait for an in-progress scaling activity or health check replacement to complete and a cooldown period to end before it responds to additional alarms. In contrast, with step scaling, the policy continues to respond to additional alarms, even while a scaling activity or health check replacement is in progress. This means that Amazon EC2 Auto Scaling evaluates all alarm breaches as it receives the alarm messages. Because of this, we recommend that you use step scaling policies instead, even if you have only a single scaling adjustment.
Amazon EC2 Auto Scaling originally supported only simple scaling policies. If you created your scaling policy before target tracking and step scaling policies were introduced, your policy is treated as a simple scaling policy.
Use the following put-scaling-policy command to create a simple scaling
policy named my-simple-scale-out-policy
, with an adjustment
type of PercentChangeInCapacity
that increases the capacity
of the group by 30 percent when the associated CloudWatch alarm breaches the
metric high threshold value.
aws autoscaling put-scaling-policy --policy-name
my-simple-scale-out-policy
\ --auto-scaling-group-namemy-asg
--scaling-adjustment30
\ --adjustment-type PercentChangeInCapacity
Record the policy's Amazon Resource Name (ARN). You need it to create the CloudWatch alarm for the policy.
Use the following put-scaling-policy command to create a simple scaling
policy named my-simple-scale-in-policy
, with an adjustment
type of ChangeInCapacity
that decreases the capacity of the
group by one instance when the associated CloudWatch alarm breaches the metric
low threshold value.
aws autoscaling put-scaling-policy --policy-name
my-simple-scale-in-policy
\ --auto-scaling-group-namemy-asg
--scaling-adjustment-1
\ --adjustment-type ChangeInCapacity --cooldown180
Record the policy's Amazon Resource Name (ARN). You need it to create the CloudWatch alarm for the policy.