Using KeyPrefix does not delete the s3 bucket after "sls remove" command.
See original GitHub issueThis is a:
- [] Feature request or change
- Bug report
For bug reports:
Expected behavior
“sls remove” should remove the bucket
Actual behavior
objects was deleted but the bucket remains, although it is empty but in a long run it will pile up on my aws account.
Steps to reproduce
Added KeyPrefix to yml file.
custom: client: keyPrefix: 'samplepref'
Below is the result of “remove” command.
I think this block of code has something to do with the behavior.
- **Operating system:osx
- **serverless-finch version:2.8.0
serverless.yml
that produces bug:- Command that produces bug:
- Other details:
For feature requests or changes:
Current behavior (if any)
Proposed behavior
Proposed implementation deatils (optional)
Justification
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Cannot deploy/remove stack because S3 bucket is gone
I just ran into a situation where sls remove (1.17.0) failed to remove my ... After deleting the Stack manually using the AWS...
Read more >How to delete the CloudFormation stack - Serverless Forums
Step 1. sls remove. Which deleted only the S3 bucket where lambda jar was deployed. Other S3 bucket had data in it so...
Read more >AWS::S3::Bucket - AWS CloudFormation
You can only delete empty buckets. Deletion fails for buckets that have contents. Syntax. To declare this entity in your AWS CloudFormation template,...
Read more >Deleting S3 files with a given prefix only
I'm assigned a job where I've to delete files which have a specific prefix. There are around 300,000 files with the given prefix...
Read more >Destroy resources created via Serverless without ...
The Serverless Framework uses AWS CloudFormation under the hood. So deleting things manually is no good idea. Just keep in mind: Resources ...
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
@mikejpeters - I also prefer clean sensible defaults so as long as we release this with a major version bump I’m fine with it. I agree it probably makes sense and there’s aren’t many people who would object to it but it does change default behavior destructively and there’s always some weird use cases we can’t predict.
When including this:
Then we’re covering our bases and should be fine.
Thanks for the response. I’m assuming you wouldn’t want this plugin to delete the bucket if there are still other objects i (e.g. in your case feature branches)?
@fernando-mc can you weigh in on this again when you have a chance? If the plugin deletes the objects at the prefix, and then only deletes the bucket if it’s completely empty I don’t see a downside. But maybe I’m missing some danger / use case? Having a new option like “force remove bucket” is safer but IMO less user-friendly. I like having smart defaults / less options, even if it means releasing a new major version with breaking changes