I updated my Auto Scaling group, but I didn't get the results that I expected during an AWS CloudFormation stack update.
Short description
The AWS::AutoScaling::AutoScalingGroup resource uses the UpdatePolicy attribute to define how an Auto Scaling group resource is updated when the CloudFormation stack is updated. If you don't have the correct settings configured for the UpdatePolicy attribute, then your rolling update can produce unexpected results.
Use the AutoScalingRollingUpdate policy to control how CloudFormation handles rolling updates for an Auto Scaling group.
Note: The following resolution applies only to the AutoScalingRollingUpdate 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
}
}
Resolution
To troubleshoot what's preventing your Auto Scaling group from updating correctly during a stack update, review the following scenarios:
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, then PauseTime acts as a timeout value. CloudFormation waits to receive a success signal until the maximum time specified by the PauseTime value. If a signal isn't received, CloudFormation cancels the update. Then, 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 are waiting for a success signal for each instance, then set the value of the MinSuccessfulInstancesPercent property in your AutoScalingRollingUpdate policy.
Note: Setting the MinSuccessfulInstancesPercent property prevents 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
If an unexpected scaling action changes the state of the Auto Scaling group during a rolling update, then the update can fail. To avoid such failures, suspend the following Auto Scaling processes during a rolling update:
- HealthCheck
- ReplaceUnhealthy
- AZRebalance
- AlarmNotification
- ScheduledActions
- InstanceRefresh
Important: If you're using your Auto Scaling group with Elastic Load Balancing, don't suspend the following processes: Launch, Terminate, and AddToLoadBalancer. These processes are necessary for rolling updates.