I made updates to my Auto Scaling group, and I didn't get the results that I expected during an AWS CloudFormation Stack update. How can I get the results that I want?

The AWS::AutoScaling::AutoScalingGroup resource uses the UpdatePolicy attribute to define how an Auto Scaling group resource is updated when the AWS CloudFormation stack is updated. If you don't have the right settings configured for the UpdatePolicy attribute, your rolling update can produce unexpected results.

You can use the AutoScalingRollingUpdate policy to control how AWS CloudFormation handles rolling updates for an Auto Scaling group. This common approach keeps the same Auto Scaling group, and then replaces the old instances based on the parameters that you set.

Note: The resolution below focuses on the AutoScalingRollingUpdate policy only. You can use the AutoScalingReplacingUpdate policy to perform an immediate rollback of the stack without any possibility of failure. For more information, see AutoScalingReplacingUpdate Policy.

The AutoScalingRollingUpdate policy supports the following configuration options:

"UpdatePolicy": {
  "AutoScalingRollingUpdate": {
    "MaxBatchSize": Integer,
    "MinInstancesInService": Integer,
    "MinSuccessfulInstancesPercent": Integer,
    "PauseTime": String,
    "SuspendProcesses": [ List of processes ],
    "WaitOnResourceSignals": Boolean
  }
}

To find out what's preventing your Auto Scaling group from updating correctly during a stack update, work through the following troubleshooting scenarios as needed:

Configure WaitOnResourceSignals and PauseTime to avoid problems with success signals

In your AutoScalingRollingUpdate policy, set the WaitOnResourceSignals property to false.

Note: If WaitOnResourceSignals is set to true, PauseTime changes to a timeout value. AWS CloudFormation waits to receive a success signal until the maximum time specified by the PauseTime value. If a signal is not received, AWS CloudFormation cancels the update. Then, AWS CloudFormation rolls back the stack with the same settings, including the same PauseTime value. For more information, see Add an UpdatePolicy to an Auto Scaling Group.

Configure MinSuccessfulInstancesPercent to avoid stack rollback

If you're replacing a large number of instances during a rolling update and waiting for a success signal for each instance, complete the following:

In your AutoScalingRollingUpdate policy, set the value of the MinSuccessfulInstancesPercent property.

Note: Setting the MinSuccessfulInstancesPercent property prevents AWS CloudFormation from rolling back the entire stack if only a single instance fails to launch. For more information, see UpdatePolicy Attribute.

Configure SuspendProcesses to avoid unexpected changes to the Auto Scaling group

During a rolling update, suspend the following Auto Scaling processes: HealthCheck, ReplaceUnhealthy, AZRebalance, AlarmNotification, and ScheduledActions.

Important: If you're using your Auto Scaling group with Elastic Load Balancing (ELB), do not suspend the following processes: Launch, Terminate, and AddToLoadBalancer. These processes are required to make rolling updates.

Note: If an unexpected scaling action changes the state of the Auto Scaling group during a rolling update, the update can fail. The failure can result from an inconsistent view of the group by AWS CloudFormation.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-09-09

Updated: 2019-02-11