Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I undo an AWS stack rollback?

I've been following these instructions. https://cloudonaut.io/serverless-image-resizing-at-any-scale/

I wanted to create a stack that would take images saved in one S3 bucket, resize them and save them to another bucket. I followed the instructions and it worked perfectly except it created a couple of buckets I didn't want. I thought I'd delete them, rollback the stack and start from the beginning. The rollback went fine.

I create a new stack but now when I check the new stack status I get the following message in the AWS CLI:

[
    "ROLLBACK_COMPLETE"
]

I've tried creating stacks with different names but all the stacks have the same status.

Any ideas? Is it possible to un-rollback a rollback? Is it possible to delete all reference to that stack so I can create a new one?

like image 260
Andy Avatar asked Apr 11 '16 10:04

Andy


2 Answers

It is not possible to un-rollback.

What you can do instead is update your CloudFormation template to your desired state and then update your stack. This would move the stack "forward" to the desired state.

You can completely delete a stack using the AWS Management Console, or using the aws cloudformation delete-stack CLI command.

http://docs.aws.amazon.com/cli/latest/reference/cloudformation/delete-stack.html

This would allow you to create a fresh stack with the same name.

Note, that deleting the stack will delete all the resources created by that stack, including your S3 buckets, etc.

Also, in order to successfully delete the s3 buckets, the buckets need to be completely empty. So empty all your S3 buckets before you delete the stack.

like image 197
Matt Houser Avatar answered Sep 20 '22 22:09

Matt Houser


So, I found a solution. I checked the console as Sulayman Touray suggested. When I checked it I found that the script would fail, begin a rollback of the changes it started making and then would delete. When I checked the status it said "Rollback in progress" because at that point it was rolling back. If I had waited 20 minutes longer I would see that the rollback was complete and the stack no longer would exist.

As to what was causing it to fail. It's something stupid. I created the buckets on the North America instance of S3. That would allow me to use capital letters (uppercase). I could manually create the buckets with capital letters. When I attempted to create the buckets using the CLI it would also allow me to create buckets with upper case. However when the script attempted to create the uppercase buckets it failed because uppercase characters weren't allowed. Once I removed the uppercase letters it would create the stack without any difficulties.

I have no idea why the script would fail because of that, it just did. However I have it working now with lowercase letters and that's good enough for me. :)

like image 40
Andy Avatar answered Sep 20 '22 22:09

Andy