CleanUp custom resource fails to delete bucket due when deleting the stack
See original GitHub issueDescribe the bug
I deployed the cloudformation stack successfully and used the perspective UI. When attempting to delete the stack it failed to delete the AccessLogsBucket
with the following error:
The bucket you tried to delete is not empty. You must delete all versions in the bucket.
I was able to clear out the bucket and retry the deletion which succeeded.
To Reproduce Steps to reproduce the behavior:
- Deploy the stack.
- Use Perspective.
- Delete the stack.
- See error.
Expected behavior Everything is removed seamlessly when you delete the stack.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
CleanUp custom resource fails to delete bucket due when ...
I was able to clear out the bucket and retry the deletion which succeeded. To Reproduce Steps to reproduce the behavior: Deploy the...
Read more >Delete Lambda-backed custom resources stuck in ... - AWS
1. Open the CloudFormation console. · 2. Choose the stack that contains your custom resource that's stuck in DELETE_FAILED status. · 3. Choose ......
Read more >Can I force CloudFormation to delete non-empty S3 Bucket?
This way you ensure the bucket deletion does not come first because there is another resource that depends on it, hence the depending...
Read more >How to Delete S3 Bucket Contents in CloudFormation
The custom resource will use a Lambda to delete the bucket's contents. ... ultimately the CloudFormation stack delete operation would fail.
Read more >Create and Delete S3 Object by CFN Custom Resource | Awstut
When deleting the CloudFormation stack containing the S3 bucket, automatically delete all objects in the bucket. For more information on the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, thank you for this this report. I think I know why this issue is happening: the accesslog bucket often has a very large amount of entries in it and we have a custom resource that attempts to clear down the bucket just before deletion. What most likely is happening is that due to S3’s eventual consistency model some of the deleted resources don’t appear as deleted to CloudFormation when it finally tries to delete the bucket immediately after the custom resource terminates. It probably makes sense for us to put a sleep or poll the bucket to see that it’s empty before terminating.
This turned out to be an issue with a custom resource writing to a bucket during the deletion process. A fix has been made and will be available in our 1.1.0 release.