Skip to content

How do I troubleshoot scaling issues in Application Auto Scaling?

5 minute read
0

My scalable target doesn't follow a dynamic scaling policy or a scheduled action in AWS Application Auto Scaling.

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

Troubleshoot resources that don't follow a dynamic scaling policy

Make sure that you correctly configured your CloudWatch alarm

Create an Amazon CloudWatch alarm for the correct metric based on the AWS service that you use. You must also activate the alarm action for the CloudWatch alarm that you associated with your scaling policy.

To check your CloudWatch alarm configuration, run the following describe-alarms AWS CLI command:

aws cloudwatch describe-alarms --alarm-names example-alarm

Note: Replace example-alarm with your alarm name.

In the output, check whether ActionsEnabled is true. Also, check the Namespace, MetricName, and Dimensions values to make sure that you configured the alarm for the correct metric.

Or, complete the following steps to check your CloudWatch alarm configuration in the CloudWatch console:

  1. Open the CloudWatch console.
  2. In the navigation pane, choose Alarms, and then choose All alarms.
  3. Make sure that Hide Auto Scaling alarms is deactivated.
  4. Under Details, make sure that the alarm uses the correct metric.
  5. Choose the Actions tab, and then check for the Actions disabled note.

To activate an alarm action, run the following enable-alarm-actions command:

aws cloudwatch enable-alarm-actions --alarm-names example-alarm

Note: Replace example-alarm with your alarm name.

To create an alarm for the correct metric, see Create an alarm that invokes a scaling policy or Create a target tracking scaling policy. For a list of example metrics that you can create alarms for, see CloudWatch metrics for monitoring resource usage.

Make sure that you activated scaling activities for your target

Check whether your target's scaling activities are suspended. If they're suspended, then resume them.

To review your scaling activities, run the following describe-scaling-activities command:

aws application-autoscaling describe-scaling-activities --include-not-scaled-activities --service-namespace example-service-namespace --scalable-dimension example-scalable-dimension --resource-id example-resource-id

Note: Replace example-service-namespace with the namespace of the AWS service that provides the resource, example-scalable-dimension with the scalable dimension, and example-resource-id with the resource ID.

In the output, check the NotScaledReasons value. If it's AlreadyAtMaxCapacity, then your scalable target already reached its maximum capacity. If it's AlreadyAtDesiredCapacity, then the scaling policy might not scale even if you activated your CloudWatch alarm. For more information, see Reason codes.

Note: If scaling didn't happen multiple times for the same reason code, then check the previous NotScaledReasons value. The output doesn't show duplicate values.

Check for active scaling activities that occur during step scaling policy cooldown periods or target tracking scaling policy cooldown periods. Application Auto Scaling doesn't scale in during cooldown periods. If a scale out is larger than a scaling activity that's in progress or in cooldown, then Application Auto Scaling scales out during the activity.

Make sure that you don't have competing scaling policies

To review your scaling policies, run the following describe-scaling-policies command:

aws application-autoscaling describe-scaling-policies --service-namespace example-service-namespace --scalable-dimension example-scalable-dimension --resource-id example-resource-id

Note: Replace example-service-namespace with the namespace of the AWS service that provides the resource, example-scalable-dimension with the scalable dimension, and example-resource-id with the resource ID.

In the output, check whether you have multiple policies. If two policies activate at the same time, then Application Auto Scaling uses the policy with the larger effect. For example, if one policy adds two resources and another adds five, then Application Auto Scaling adds five resources. You can't use the describe-scaling-activities command to check for multiple policies.

If you use a target tracking scaling policy, then also make sure that the DisableScaleIn parameter is False to activate scale in. By default, the parameter value is False.

If DisableScaleIn is True, then update the scaling policy JSON file to set DisableScaleIn to False. Then, run the following put-scaling-policy command to apply your changes:

aws application-autoscaling put-scaling-policy \
--service-namespace example-service-namespace --scalable-dimension example-scalable-dimension --resource-id example-resource-id --policy-name example-name --policy-type TargetTrackingScaling --target-tracking-scaling-policy-configuration file://example.json

Note: Replace example-service-namespace with the namespace of the AWS service that provides the resource, example-scalable-dimension with the scalable dimension, and example-resource-id with the resource ID. Also, replace example-name with the policy name and example.json with the scaling policy JSON file.

Troubleshoot a scalable target that doesn't respond to a scheduled action

Check whether you configured a time zone for the scheduled action. By default, scheduled actions are in the UTC+0 time zone. If you set a time zone, then run the following describe-scheduled-actions command to verify that the action runs based on that time zone:

aws application-autoscaling describe-scheduled-actions \
    --service-namespace example-service-namespace --resource-id example-resource-id --scheduled-action-names example-name

Note: Replace example-namespace with the namespace of the AWS service that provides the resource, example-resource-id with the resource ID, and example-name with the action name.

Also, check the output of the preceding command to identify whether you specified a StartTime. If you specify a StartTime value, then Application Auto Scaling activates the scheduled action at that time first. After the specified start time, Application Auto Scaling activates the scheduled activity based on the cron or rate expression that you specify.

To review the scalable target's activity history for scaling activities that conflict with your scheduled action, run the following describe-scaling-activities command:

aws application-autoscaling describe-scaling-activities --include-not-scaled-activities --service-namespace example-service-namespace --scalable-dimension example-scalable-dimension --resource-id example-resource-id

Note: Replace example-service-namespace with the namespace of the AWS service that provides the resource, example-scalable-dimension with the scalable dimension, and example-resource-id with the resource's identifier.

If you scheduled scale out and scale in actions, then verify that you scheduled one action for scaling out and another action for scaling in. You can't use the same scheduled action to scale in and scale out.

Related information

How do I troubleshoot scaling issues with my Amazon EC2 Auto Scaling group?

AWS OFFICIALUpdated 10 months ago