Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable rollback on failure in my template?

I'm working on a CloudFormation template, and an update is failing to apply. I'd like to set the stack option Rollback on Failure to "No" in order to keep the resources around for debugging. How can I disable "rollback on failure" in my CloudFormation template?

like image 663
Evan Kroske Avatar asked Jul 26 '17 22:07

Evan Kroske


People also ask

How do I turn off rollback in CloudFormation?

Specify the disable-rollback option or on-failure DO_NOTHING enumeration during an execute-change-set operation. Provide a stack name and template to the execute-change-set command with the disable-rollback option. The command returns the following output. Initiate the change set with disable-rollback option.

Why did my CloudFormation stack rollback?

Because AWS CloudFormation doesn't know the database was deleted, it assumes that the database instance still exists and attempts to roll back to it, causing the update rollback to fail. Depending on the cause of the failure, you can manually fix the error and continue the rollback.

What happens when CloudFormation stack creation fails?

If stack creation fails, go to the CloudFormation Resources list in the AWS Management Console to find the log group. Note that if stack creation fails before any instances are launched, a log group might not be created. By default, AWS deletes CloudWatch log groups if stack creation fails.


1 Answers

Updated answer

You can now pass a DisableRollback parameter (defaults to false) when running your update stack command. See the docs here:

https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStack.html


Outdated

I think that option is only available on creation of a stack. The description says Specifies whether the stack should be rolled back if stack creation fails..

If you look at the AWS CLI, there is a --disable-rollback flag available for aws cloudformation create-stack but no such option exists for aws cloudformation update-stack.

See here for references also:

  • create-stack
  • update-stack
  • Similar issues posted here

Hope that helps.

like image 192
n00b Avatar answered Nov 05 '22 16:11

n00b