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

6 minute read
0

My Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling group isn't scaling correctly.

Resolution

Based on your scaling issues, perform the following checks on your EC2 Auto Scaling configurations.

My EC2 Auto Scaling group isn't following the scaling policy

Check your scaling policies to see whether an event invokes more than one policy. If two policies scale at the same time, then EC2 Auto Scaling follows the policy with the greater effect.

For example, assume you have one policy to add two instances and another policy to add four instances. In this case, EC2 Auto Scaling adds four instances when both policies scale at the same time.

If you have multiple target tracking scaling policies, then only one of these policies performs a scale out. However, all target tracking scaling policies must be ready to scale in at the same time for a scale-in action to occur.

My EC2 Auto Scaling group is scaling out instead of scaling in

Verify that the scale-out policy and the scale-in policy scale at the same time. When both policies scale at the same time, EC2 Auto Scaling follows the scale-out policy to confirm availability.

To verify that scale-out and scale-in policies scale at the same time, complete the following checks:

  • Review your alarm history from the Amazon CloudWatch console to check whether the two associated alarms are invoked at the same time.
  • Review your Auto Scaling group's activity history from the Amazon EC2 console to check whether the associated scheduled actions run at the same time.

My EC2 Auto Scaling group isn't responding to a CloudWatch alarm or health check replacement

  • Check whether your Auto Scaling group already reached its minimum or maximum number of instances. To find the specified minimum or maximum capacity, review your EC2 Auto Scaling group's details in the Amazon EC2 console. EC2 Auto Scaling doesn't show an error message in the group's activity history when scaling is blocked because of minimum or maximum capacity.
  • Check suspended processes for your Auto Scaling group. EC2 Auto Scaling doesn't evaluate a CloudWatch scaling policy for suspended Terminate, Launch, or AlarmNotification processes. EC2 Auto Scaling doesn't evaluate a health check replacement for suspended ReplaceUnhealthy or HealthCheck processes.
  • Check to see if scale-in protection is turned on in any of your instances in your Auto Scaling group. If you turn on scale-in protection for an instance, then the instance isn't used to scale down the group. The Auto Scaling group doesn't scale down until scale-in protection is turned off on one or more of the instances.
  • If you set up a simple scaling policy, then check whether your instances are in a cooldown period. Simple scaling policies are suspended until after the cooldown period.
  • If your target tracking scaling policy isn't scaling down your Auto Scaling group, then check the policy to see whether the scale-in portion is off.
  • Are any of the scaling policies turned off? When a scaling-policy is turned off, it doesn't change the Auto Scaling group.
  • Is there a valid step adjustment for your step scaling policy? Check to see if the step adjustments are configured to react to the size of the alarm breach.
  • If you set up a step scaling policy or target tracking scaling policy, then check for an in-progress instance warm up. If you specified a warm-up time, then the Auto Scaling group doesn't count instances toward the group metrics until after the warmup.
  • Check your CloudWatch alarm to be sure that it invokes scaling activity correctly. For more information, see How can I be sure that CloudWatch alarms activate actions?
  • Check if there's a lifecycle hook configured for your EC2 Auto Scaling group. If there's a lifecycle hook, then you might need to complete the lifecycle hook or wait for the timeout period to end.

My instance is stuck in the Pending:Wait or Terminating:Wait state during scaling activity

If you configured a lifecycle hook for your EC2 Auto Scaling group, then an instance might be paused in the Pending:Wait or Terminating:Wait state. Except for step scaling policies, other scaling activities are suspended until the instance moves out of the Pending:Wait or Terminating:Wait state.

To determine whether you have a lifecycle hook configured, run the following AWS Command Line Interface (AWS CLI) command:

aws autoscaling describe-lifecycle-hooks --auto-scaling-group-name my-asg-name

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

To continue the scaling process, wait for the timeout period to end or complete the lifecycle hook.

Note: By default, the timeout period is one hour.

For information on lifecycle hook management in the Amazon EC2 console, see Amazon EC2 Auto Scaling lifecycle hooks.

My EC2 Auto Scaling group isn't responding to a scheduled action

  • Check the time zone you configured for the scheduled action. By default, scheduled actions are set in Coordinated Universal Time (UTC) when no time zone is set. If a time zone is set for the scheduled action, then verify that the action is running based on the time in that time zone.
  • Review your EC2 Auto Scaling group's activity history in the Amazon EC2 console. Determine whether there's any scaling activity that conflicts with your scheduled action.
  • If you schedule scale-out and scale-in actions, then check that you scheduled one action for scaling out and another action for scaling in. You can't use the same scheduled action to both scale in and scale out.

I reached my EC2 instance quota

If your EC2 Auto Scaling group isn't scaling because of your EC2 instance quota, then you receive a message similar to the following:

Launching a new EC2 instance. Status Reason: Your quota allows for 0 more running instance(s).
You requested at least 1. Launching EC2 instance failed.

To increase the quota, contact AWS Support. For more information on quotas, see AWS service quotas.

Related information

Amazon EC2 Auto Scaling instance lifecycle

Troubleshoot Amazon EC2 Auto Scaling

AWS OFFICIAL
AWS OFFICIALUpdated 4 months ago
No comments