Step and simple scaling policies for Amazon EC2 Auto Scaling - Amazon EC2 Auto Scaling

Step and simple scaling policies for Amazon EC2 Auto Scaling

Step scaling and simple scaling policies scale the capacity of your Auto Scaling group in predefined increments based on CloudWatch alarms. You can define separate scaling policies to handle scaling out (increasing capacity) and scaling in (decreasing capacity) when an alarm threshold is breached.

With step scaling and simple scaling, you create and manage the CloudWatch alarms that invoke the scaling process. When an alarm is breached, Amazon EC2 Auto Scaling initiates the scaling policy associated with that alarm.

We strongly recommend that you use target tracking scaling policies to scale on metrics like average CPU utilization or average request count per target. Metrics that decrease when capacity increases and increase when capacity decreases can be used to proportionally scale out or in the number of instances using target tracking. This helps ensure that Amazon EC2 Auto Scaling follows the demand curve for your applications closely. For more information, see Target tracking scaling policies.

How step scaling policies work

To use step scaling, you first create a CloudWatch alarm that monitors a metric for your Auto Scaling group. Define the metric, threshold value, and number of evaluation periods that determine an alarm breach. Then, create a step scaling policy that defines how to scale your group when the alarm threshold is breached.

Add the step adjustments in the policy. You can define different step adjustments based on the breach size of the alarm. For example:

  • Scale out by 10 instances if the alarm metric reaches 60 percent

  • Scale out by 30 instances if the alarm metric reaches 75 percent

  • Scale out by 40 instances if the alarm metric reaches 85 percent

When the alarm threshold is breached for the specified number of evaluation periods, Amazon EC2 Auto Scaling will apply the step adjustments defined in the policy. The adjustments can continue for additional alarm breaches until the alarm state returns to OK.

Each instance has a warm-up period to prevent scaling activities from being too reactive to changes that occur over short periods of time. You can optionally configure the warm-up period for your scaling policy. However, we recommend using the default instance warmup to make it easier to update all scaling policies when the warm-up time changes. For more information, see Set the default instance warmup for an Auto Scaling group.

Simple scaling policies are similar to step scaling policies, except they're based on a single scaling adjustment, with a cooldown period between each scaling activity. For more information, see Simple scaling policies.

Step adjustments for step scaling

When you create a step scaling policy, you specify one or more step adjustments that automatically scale the number of instances dynamically based on the size of the alarm breach. Each step adjustment specifies the following:

  • A lower bound for the metric value

  • An upper bound for the metric value

  • The amount by which to scale, based on the scaling adjustment type

CloudWatch aggregates metric data points based on the statistic for the metric that's associated with your CloudWatch alarm. When the alarm is breached, the appropriate scaling policy is invoked. Amazon EC2 Auto Scaling applies the aggregation type to the most recent metric data points from CloudWatch (as opposed to the raw metric data). It compares this aggregated metric value against the upper and lower bounds defined by the step adjustments to determine which step adjustment to perform.

You specify the upper and lower bounds relative to the breach threshold. For example, let's say you made a CloudWatch alarm and a scale-out policy for when the metric is above 50 percent. You then made a second alarm and a scale-in policy for when the metric is below 50 percent. You made a set of step adjustments with an adjustment type of PercentChangeInCapacity (or Percent of group in the console) for each policy:

Example: Step adjustments for scale-out policy
Lower bound Upper bound Adjustment

0

10

0

10

20

10

20

null

30

Example: Step adjustments for scale-in policy
Lower bound Upper bound Adjustment

-10

0

0

-20

-10

-10

null

-20

-30

This creates the following scaling configuration.

Metric value -infinity 30% 40% 60% 70% infinity ----------------------------------------------------------------------- -30% | -10% | Unchanged | +10% | +30% -----------------------------------------------------------------------

Now, let's say that you use this scaling configuration on an Auto Scaling group that has both a current capacity and a desired capacity of 10. The following points summarize the behavior of the scaling configuration in relation to the desired and current capacity of the group:

  • The desired and current capacity is maintained while the aggregated metric value is greater than 40 and less than 60.

  • If the metric value gets to 60, the desired capacity of the group increases by 1 instance, to 11 instances, based on the second step adjustment of the scale-out policy (add 10 percent of 10 instances). After the new instance is running and its specified warm-up time has expired, the current capacity of the group increases to 11 instances. If the metric value rises to 70 even after this increase in capacity, the desired capacity of the group increases by another 3 instances, to 14 instances. This is based on the third step adjustment of the scale-out policy (add 30 percent of 11 instances, 3.3 instances, rounded down to 3 instances).

  • If the metric value gets to 40, the desired capacity of the group decreases by 1 instance, to 13 instances, based on the second step adjustment of the scale-in policy (remove 10 percent of 14 instances, 1.4 instances, rounded down to 1 instance). If the metric value falls to 30 even after this decrease in capacity, the desired capacity of the group decreases by another 3 instances, to 10 instances. This is based on the third step adjustment of the scale-in policy (remove 30 percent of 13 instances, 3.9 instances, rounded down to 3 instances).

When you specify the step adjustments for your scaling policy, note the following:

  • If you use the AWS Management Console, you specify the upper and lower bounds as absolute values. If you use the AWS CLI or an SDK, you specify the upper and lower bounds relative to the breach threshold.

  • The ranges of your step adjustments can't overlap or have a gap.

  • Only one step adjustment can have a null lower bound (negative infinity). If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.

  • Only one step adjustment can have a null upper bound (positive infinity). If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.

  • The upper and lower bound can't be null in the same step adjustment.

  • If the metric value is above the breach threshold, the lower bound is inclusive and the upper bound is exclusive. If the metric value is below the breach threshold, the lower bound is exclusive and the upper bound is inclusive.

Scaling adjustment types

You can define a scaling policy that performs the optimal scaling action, based on the scaling adjustment type that you choose. You can specify the adjustment type as a percentage of the current capacity of your Auto Scaling group, or in capacity units. Normally a capacity unit means one instance, unless you are using the instance weights feature.

Amazon EC2 Auto Scaling supports the following adjustment types for step scaling and simple scaling:

  • ChangeInCapacity — Increment or decrement the current capacity of the group by the specified value. A positive value increases the capacity and a negative adjustment value decreases the capacity. For example: If the current capacity of the group is 3 and the adjustment is 5, then when this policy is performed, we add 5 capacity units to the capacity for a total of 8 capacity units.

  • ExactCapacity — Change the current capacity of the group to the specified value. Specify a non-negative value with this adjustment type. For example: If the current capacity of the group is 3 and the adjustment is 5, then when this policy is performed, we change the capacity to 5 capacity units.

  • PercentChangeInCapacity — Increment or decrement the current capacity of the group by the specified percentage. A positive value increases the capacity and a negative value decreases the capacity. For example: If the current capacity is 10 and the adjustment is 10 percent, then when this policy is performed, we add 1 capacity unit to the capacity for a total of 11 capacity units.

    Note

    If the resulting value is not an integer, it is rounded as follows:

    • Values greater than 1 are rounded down. For example, 12.7 is rounded to 12.

    • Values between 0 and 1 are rounded to 1. For example, .67 is rounded to 1.

    • Values between 0 and -1 are rounded to -1. For example, -.58 is rounded to -1.

    • Values less than -1 are rounded up. For example, -6.67 is rounded to -6.

With PercentChangeInCapacity, you can also specify the minimum number of instances to scale using the MinAdjustmentMagnitude parameter. For example, suppose that you create a policy that adds 25 percent and you specify a minimum increment of 2 instances. If you have an Auto Scaling group with 4 instances and the scaling policy is executed, 25 percent of 4 is 1 instance. However, because you specified a minimum increment of 2, there are 2 instances added.

When you use instance weights, the effect of setting the MinAdjustmentMagnitude parameter to a non-zero value changes. The value is in capacity units. To set the minimum number of instances to scale, set this parameter to a value that is at least as large as your largest instance weight.

If you use instance weights, keep in mind that the current capacity of your Auto Scaling group can exceed the desired capacity as needed. If your absolute number to decrement, or the amount that the percentage says to decrement, is less than the difference between current and desired capacity, no scaling action is taken. You must take these behaviors into account when you look at the outcome of a scaling policy when a threshold alarm is in breach. For example, suppose that the desired capacity is 30 and the current capacity is 32. When the alarm is in breach, if the scaling policy decrements the desired capacity by 1, then no scaling action is taken.

Instance warm-up

For step scaling, you can optionally specify the number of seconds that it takes for a newly launched instance to warm up. Until its specified warm-up time has expired, an instance is not counted toward the aggregated EC2 instance metrics of the Auto Scaling group.

While instances are in the warm-up period, your scaling policies only scale out if the metric value from instances that are not warming up is greater than the policy's alarm high threshold.

If the group scales out again, the instances that are still warming up are counted as part of the desired capacity for the next scale-out activity. Therefore, multiple alarm breaches that fall in the range of the same step adjustment result in a single scaling activity. The intention is to continuously (but not excessively) scale out.

For example, let's say that you create a policy with two steps. The first step adds 10 percent when the metric gets to 60, and the second step adds 30 percent when the metric gets to 70 percent. Your Auto Scaling group has a desired and current capacity of 10. The desired and current capacity do not change while the aggregated metric value is less than 60. Suppose that the metric gets to 60, so 1 instance is added (10 percent of 10 instances). Then, the metric gets to 62 while the new instance is still warming up. The scaling policy calculates the new desired capacity based on the current capacity, which is still 10. However, the desired capacity of the group has already increased to 11 instances, so the scaling policy does not increase the desired capacity further. If the metric gets to 70 while the new instance is still warming up, we should add 3 instances (30 percent of 10 instances). However, the desired capacity of the group is already 11, so we add only 2 instances, for a new desired capacity of 13 instances.

While the scale-out activity is in progress, all scale-in activities initiated by scaling policies are blocked until the instances finish warming up. When the instances finish warming up, if a scale-in event occurs, any instances currently in the process of terminating will be counted towards the current capacity of the group when calculating the new desired capacity. Therefore, we don't remove more instances from the Auto Scaling group than necessary. For example, while an instance is already terminating, if an alarm is in breach in the range of the same step adjustment that decremented the desired capacity by 1, then no scaling action is taken.

Default value

If no value is set, then the scaling policy will use the default value, which is the value for the default instance warmup defined for the group. If the default instance warmup is null, then it falls back to the value of the default cooldown.

Considerations

The following considerations apply when working with step and simple scaling policies:

  • Consider whether you can predict the step adjustments on the application accurately enough to use step scaling. If your scaling metric increases or decreases proportionally to the capacity of the scalable target, we recommend that you use a target tracking scaling policy instead. You still have the option to use step scaling as an additional policy for a more advanced configuration. For example, you can configure a more aggressive response when utilization reaches a certain level.

  • Make sure to choose an adequate margin between the scale-out and scale-in thresholds to prevent flapping. Flapping is an infinite loop of scaling in and scaling out. That is, if a scaling action is taken, the metric value would change and start another scaling action in the reverse direction.

Create a step scaling policy for scale out

To create a step scaling policy for scale out for your Auto Scaling group, use one of the following methods:

Console
Step 1: Create a CloudWatch alarm for the metric high threshold
  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. If necessary, change the Region. From the navigation bar, select the Region where your Auto Scaling group resides.

  3. In the navigation pane, choose Alarms, All alarms and then choose Create alarm.

  4. Choose Select metric.

  5. 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.

  6. 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.

  7. 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 greater than or greater 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-out policy (metric high), make sure you do not choose less than or less than or equal to the threshold.

  8. 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.

  9. Choose Next.

    The Configure actions page appears.

  10. Under Notification, select an Amazon SNS topic to notify when the alarm is in ALARM state, OK state, or INSUFFICIENT_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.

  11. 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.

  12. Choose Next.

  13. Enter a name (for example, Step-Scaling-AlarmHigh-AddCapacity) and, optionally, a description for the alarm, and then choose Next.

  14. 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 out
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/, and choose Auto Scaling Groups from the navigation pane.

  2. Select the check box next to your Auto Scaling group.

    A split pane opens up in the bottom of the page.

  3. Verify that the scaling limits are appropriately set. For example, if your group's desired capacity is already at its maximum, you need to specify a new maximum in order to scale out. For more information, see Set scaling limits for your Auto Scaling group.

  4. On the Automatic scaling tab, in Dynamic scaling policies, choose Create dynamic scaling policy.

  5. For Policy type, choose Step scaling, and then specify a name for the policy.

  6. 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.

  7. Specify the change in the current group size that this policy will make when executed using Take the action. You can add 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-out policy that increases the capacity of the group by 30 percent, choose Add, enter 30 in the next field, and then choose percent of group. By default, the lower bound for this step adjustment is the alarm threshold and the upper bound is positive (+) infinity.

  8. 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.

  9. To set a minimum number of instances to scale, update the number field in Add capacity units in increments of at least 1 capacity units.

  10. (Optional) For Instance warmup, update the instance warm-up value as needed.

  11. Choose Create.

AWS CLI

To create a step scaling policy for scale out (increase capacity), you can use the following example commands. Replace each user input placeholder with your own information.

When you use the AWS CLI, you first create a step scaling policy that provides instructions to Amazon EC2 Auto Scaling about how to scale out when a metric's value is increasing. Then, you create the alarm by identifying the metric to watch, defining the metric high threshold and other details for the alarms, and associating the alarm with the scaling policy.

Step 1: Create a policy for scale out

Use the following put-scaling-policy command to create a step scaling policy named my-step-scale-out-policy, with an adjustment type of PercentChangeInCapacity that increases the capacity of the group based on the following step adjustments (assuming a CloudWatch alarm threshold of 60 percent):

  • Increase the instance count by 10 percent when the value of the metric is greater than or equal to 60 percent but less than 75 percent

  • Increase the instance count by 20 percent when the value of the metric is greater than or equal to 75 percent but less than 85 percent

  • Increase the instance count by 30 percent when the value of the metric is greater than or equal to 85 percent

aws autoscaling put-scaling-policy \ --auto-scaling-group-name my-asg \ --policy-name my-step-scale-out-policy \ --policy-type StepScaling \ --adjustment-type PercentChangeInCapacity \ --metric-aggregation-type Average \ --step-adjustments MetricIntervalLowerBound=0.0,MetricIntervalUpperBound=15.0,ScalingAdjustment=10 \ MetricIntervalLowerBound=15.0,MetricIntervalUpperBound=25.0,ScalingAdjustment=20 \ MetricIntervalLowerBound=25.0,ScalingAdjustment=30 \ --min-adjustment-magnitude 1

Record the policy's Amazon Resource Name (ARN). You need it to create a CloudWatch alarm for the policy.

{ "PolicyARN": "arn:aws:autoscaling:region:123456789012:scalingPolicy:4ee9e543-86b5-4121-b53b-aa4c23b5bbcc:autoScalingGroupName/my-asg:policyName/my-step-scale-in-policy }
Step 2: Create a CloudWatch alarm for the metric high threshold

Use the following CloudWatch put-metric-alarm command to create an alarm that increases the size of the Auto Scaling group based on an average CPU threshold value of 60 percent for at least two consecutive evaluation periods of two minutes. To use your own custom metric, specify its name in --metric-name and its namespace in --namespace.

aws cloudwatch put-metric-alarm --alarm-name Step-Scaling-AlarmHigh-AddCapacity \ --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average \ --period 120 --evaluation-periods 2 --threshold 60 \ --comparison-operator GreaterThanOrEqualToThreshold \ --dimensions "Name=AutoScalingGroupName,Value=my-asg" \ --alarm-actions PolicyARN

Create a step scaling policy for scale in

To create a step scaling policy for scale in for your Auto Scaling group, use one of the following methods:

Console
Step 1: Create a CloudWatch alarm for the metric low threshold
  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. If necessary, change the Region. From the navigation bar, select the Region where your Auto Scaling group resides.

  3. In the navigation pane, choose Alarms, All alarms and then choose Create alarm.

  4. Choose Select metric.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. Choose Next.

    The Configure actions page appears.

  10. Under Notification, select an Amazon SNS topic to notify when the alarm is in ALARM state, OK state, or INSUFFICIENT_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.

  11. 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.

  12. Choose Next.

  13. Enter a name (for example, Step-Scaling-AlarmLow-RemoveCapacity) and, optionally, a description for the alarm, and then choose Next.

  14. 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
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/, and choose Auto Scaling Groups from the navigation pane.

  2. Select the check box next to your Auto Scaling group.

    A split pane opens up in the bottom of the page.

  3. 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.

  4. On the Automatic scaling tab, in Dynamic scaling policies, choose Create dynamic scaling policy.

  5. For Policy type, choose Step scaling, and then specify a name for the policy.

  6. 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.

  7. 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, enter 2 in the next field, and then choose capacity units. By default, the upper bound for this step adjustment is the alarm threshold and the lower bound is negative (-) infinity.

  8. 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.

  9. Choose Create.

AWS CLI

To create a step scaling policy for scale in (decrease capacity), you can use the following example commands. Replace each user input placeholder with your own information.

When you use the AWS CLI, you first create a step scaling policy that provides instructions to Amazon EC2 Auto Scaling about how to scale in when a metric's value is decreasing. Then, you create the alarm by identifying the metric to watch, defining the metric low threshold and other details for the alarms, and associating the alarm with the scaling policy.

Step 1: Create a policy for scale in

Use the following put-scaling-policy command to create a step scaling policy named my-step-scale-in-policy, with an adjustment type of ChangeInCapacity that decreases the capacity of the group by 2 instances when the associated CloudWatch alarm breaches the metric low threshold value.

aws autoscaling put-scaling-policy \ --auto-scaling-group-name my-asg \ --policy-name my-step-scale-in-policy \ --policy-type StepScaling \ --adjustment-type ChangeInCapacity \ --step-adjustments MetricIntervalUpperBound=0.0,ScalingAdjustment=-2

Record the policy's Amazon Resource Name (ARN). You need it to create the CloudWatch alarm for the policy.

{ "PolicyARN": "arn:aws:autoscaling:region:123456789012:scalingPolicy:ac542982-cbeb-4294-891c-a5a941dfa787:autoScalingGroupName/my-asg:policyName/my-step-scale-out-policy }
Step 2: Create a CloudWatch alarm for the metric low threshold

Use the following CloudWatch put-metric-alarm command to create an alarm that decreases the size of the Auto Scaling group based on average CPU threshold value of 40 percent for at least two consecutive evaluation periods of two minutes. To use your own custom metric, specify its name in --metric-name and its namespace in --namespace.

aws cloudwatch put-metric-alarm --alarm-name Step-Scaling-AlarmLow-RemoveCapacity \ --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average \ --period 120 --evaluation-periods 2 --threshold 40 \ --comparison-operator LessThanOrEqualToThreshold \ --dimensions "Name=AutoScalingGroupName,Value=my-asg" \ --alarm-actions PolicyARN

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-name my-asg --scaling-adjustment 30 \ --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-name my-asg --scaling-adjustment -1 \ --adjustment-type ChangeInCapacity --cooldown 180

Record the policy's Amazon Resource Name (ARN). You need it to create the CloudWatch alarm for the policy.