Disable a scaling policy for an Auto Scaling group
This topic describes how to temporarily disable a scaling policy so it won't initiate changes to the number of instances the Auto Scaling group contains. When you disable a scaling policy, the configuration details are preserved, so you can quickly re-enable the policy. This is easier than temporarily deleting a policy when you don't need it, and recreating it later.
When a scaling policy is disabled, the Auto Scaling group does not scale out or scale in for the metric alarms that are breached while the scaling policy is disabled. However, any scaling activities still in progress are not stopped.
Note that disabled scaling policies still count toward your quotas on the number of scaling policies that you can add to an Auto Scaling group.
To disable a scaling policy (console)
Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/
, and choose Auto Scaling Groups from the navigation pane. -
Select the check box next to the Auto Scaling group.
A split pane opens up in the bottom of the page.
-
On the Automatic scaling tab, under Dynamic scaling policies, select the check box in the top right corner of the desired scaling policy.
-
Scroll to the top of the Dynamic scaling policies section, and choose Actions, Disable.
When you are ready to re-enable the scaling policy, repeat these steps and then choose Actions, Enable. After you re-enable a scaling policy, your Auto Scaling group may immediately initiate a scaling action if there are any alarms currently in ALARM state.
To disable a scaling policy (Amazon CLI)
Use the put-scaling-policy command with the --no-enabled
option as follows. Specify all options in the command as you would specify them
when creating the policy.
aws autoscaling put-scaling-policy --auto-scaling-group-name
my-asg
\ --policy-namemy-scaling-policy
--policy-typeTargetTrackingScaling
\ --estimated-instance-warmup360
\ --target-tracking-configuration '{ "TargetValue":70
, "PredefinedMetricSpecification": { "PredefinedMetricType": "ASGAverageCPUUtilization
" } }' \ --no-enabled
To re-enable a scaling policy (Amazon CLI)
Use the put-scaling-policy command with the --enabled
option
as follows. Specify all options in the command as you would specify them when
creating the policy.
aws autoscaling put-scaling-policy --auto-scaling-group-name
my-asg
\ --policy-namemy-scaling-policy
--policy-typeTargetTrackingScaling
\ --estimated-instance-warmup360
\ --target-tracking-configuration '{ "TargetValue":70
, "PredefinedMetricSpecification": { "PredefinedMetricType": "ASGAverageCPUUtilization
" } }' \ --enabled
To describe a scaling policy (Amazon CLI)
Use the describe-policies command to verify the enabled status of a scaling policy.
aws autoscaling describe-policies --auto-scaling-group-name
my-asg
\ --policy-namesmy-scaling-policy
The following is example output.
{
"ScalingPolicies": [
{
"AutoScalingGroupName": "my-asg",
"PolicyName": "my-scaling-policy",
"PolicyARN": "arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:1d52783a-b03b-4710-bb0e-549fd64378cc:autoScalingGroupName/my-asg:policyName/my-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"StepAdjustments": [],
"Alarms": [
{
"AlarmName": "TargetTracking-my-asg-AlarmHigh-9ca53fdd-7cf5-4223-938a-ae1199204502",
"AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmHigh-9ca53fdd-7cf5-4223-938a-ae1199204502"
},
{
"AlarmName": "TargetTracking-my-asg-AlarmLow-7010c83d-d55a-4a7a-abe0-1cf8b9de6d6c",
"AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmLow-7010c83d-d55a-4a7a-abe0-1cf8b9de6d6c"
}
],
"TargetTrackingConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "ASGAverageCPUUtilization"
},
"TargetValue": 70.0,
"DisableScaleIn": false
},
"Enabled": true
}
]
}