Delete a scaling policy for an Auto Scaling group - Amazon EC2 Auto Scaling

Delete a scaling policy for an Auto Scaling group

After you no longer need a scaling policy, you can delete it. Depending on the type of scaling policy, you might also need to delete the CloudWatch alarms. Deleting a target tracking scaling policy also deletes any associated CloudWatch alarms. Deleting a step scaling policy or a simple scaling policy deletes the underlying alarm action, but it does not delete the CloudWatch alarm, even if it no longer has an associated action.

To delete a scaling policy (console)
  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 the Auto Scaling group.

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

  3. On the Automatic scaling tab, under Dynamic scaling policies, select the check box in the top right corner of the desired scaling policy.

  4. Scroll to the top of the Dynamic scaling policies section, and choose Actions, Delete.

  5. When prompted for confirmation, choose Yes, Delete.

  6. (Optional) If you deleted a step scaling policy or a simple scaling policy, do the following to delete the CloudWatch alarm that was associated with the policy. You can skip these substeps to keep the alarm for future use.

    1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

    2. On the navigation pane, choose Alarms.

    3. Choose the alarm (for example, Step-Scaling-AlarmHigh-AddCapacity) and choose Action, Delete.

    4. When prompted for confirmation, choose Delete.

To get the scaling policies for an Auto Scaling group (AWS CLI)

Before you delete a scaling policy, use the following describe-policies command to see what scaling policies were created for the Auto Scaling group. You can use the output when deleting the policy and the CloudWatch alarms.

aws autoscaling describe-policies --auto-scaling-group-name my-asg

You can filter the results by the type of scaling policy using the --query parameter. This syntax for query works on Linux or macOS. On Windows, change the single quotes to double quotes.

aws autoscaling describe-policies --auto-scaling-group-name my-asg --query 'ScalingPolicies[?PolicyType==`TargetTrackingScaling`]'

The following is example output.

[ { "AutoScalingGroupName": "my-asg", "PolicyName": "cpu50-target-tracking-scaling-policy", "PolicyARN": "PolicyARN", "PolicyType": "TargetTrackingScaling", "StepAdjustments": [], "Alarms": [ { "AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmHigh-fc0e4183-23ac-497e-9992-691c9980c38e", "AlarmName": "TargetTracking-my-asg-AlarmHigh-fc0e4183-23ac-497e-9992-691c9980c38e" }, { "AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmLow-61a39305-ed0c-47af-bd9e-471a352ee1a2", "AlarmName": "TargetTracking-my-asg-AlarmLow-61a39305-ed0c-47af-bd9e-471a352ee1a2" } ], "TargetTrackingConfiguration": { "PredefinedMetricSpecification": { "PredefinedMetricType": "ASGAverageCPUUtilization" }, "TargetValue": 50.0, "DisableScaleIn": false }, "Enabled": true } ]
To delete your scaling policy (AWS CLI)

Use the following delete-policy command.

aws autoscaling delete-policy --auto-scaling-group-name my-asg \ --policy-name cpu50-target-tracking-scaling-policy
To delete your CloudWatch alarm (AWS CLI)

For step and simple scaling policies, use the delete-alarms command to delete the CloudWatch alarm that was associated with the policy. You can skip this step to keep the alarm for future use. You can delete one or more alarms at a time. For example, use the following command to delete the Step-Scaling-AlarmHigh-AddCapacity and Step-Scaling-AlarmLow-RemoveCapacity alarms.

aws cloudwatch delete-alarms --alarm-name Step-Scaling-AlarmHigh-AddCapacity Step-Scaling-AlarmLow-RemoveCapacity