- Newest
- Most votes
- Most comments
When a CloudFormation stack is in the ROLLBACK_COMPLETE state, it indicates that the initial creation of the stack failed and all resources have been rolled back. Unfortunately, a stack in this state cannot be updated directly.
Here are your options to resolve this situation:
- Delete and recreate the stack: The most straightforward approach is to delete the existing stack and deploy it again with the correct permissions. You can use:
aws cloudformation delete-stack --stack-name your-stack-name
And then run sam deploy again.
- Use a different stack name: If you want to avoid deleting the current stack, you can deploy with a new stack name by using the
--stack-nameparameter:
sam deploy --stack-name new-stack-name
- Use the
--on-failureoption: For future deployments, you can use the--on-failureparameter withsam deployto specify what action to take when a stack fails to create. Options include:
ROLLBACK: Rolls back to a previous known good state (default)DELETE: Deletes the stack if it failsDO_NOTHING: Neither rolls back nor deletes the stack
The key difference between SAM CLI and Serverless Framework is in how they handle failed deployments. Serverless Framework might have been configured to automatically delete failed stacks or use a different approach to stack management, which is why you didn't encounter this issue before.
Unfortunately, there's no direct way to update a stack in the ROLLBACK_COMPLETE state - you must either delete it first or create a new stack with a different name.
Sources
Stack status of UPDATE_ROLLBACK_COMPLETE but unable to update stack | AWS re:Post
sam deploy - AWS Serverless Application Model
