Posted On: Jun 20, 2023
Amazon CloudFormation now allows customers to configure the clean-up or rollback actions that CloudFormation will take when execution of a ChangeSet fails. ChangeSets are a feature of CloudFormation that allow you to preview the impact of proposed changes to a stack on running resources. CloudFormation makes changes to your stack only when you decide to execute a ChangeSet. Today, CloudFormation rolls back a stack to the last known stable state if ChangeSets execution is unsuccessful. With this launch, you can pass an optional parameter called OnStackFailure to the CreateChangeSet API and CLI commands. You can set the new parameter to the following values: ROLLBACK, DO_NOTHING, or DELETE.
You can set OnStackFailure to DELETE if you want to ensure that a stack is automatically deleted when execution of a ChangeSet fails during stack creation. This eliminates the need for manual clean-up of stacks after unsuccessful stack creations and enables faster retries. You can set OnStackFailure to DO_NOTHING if you want to preserve the state of the stack when execution of a ChangeSet fails. This preserves successfully provisioned resources and makes it easier to investigate the resources that CloudFormation failed to update.
The OnStackFailure parameter is available in Amazon Web Services China (Beijing) Region, operated by Sinnet, and Amazon Web Services China (Ningxia) Region, operated by NWCD.
To learn more about supported parameters for ChangeSet creation requests, refer to the ChangeSets documentation.