andreineculau / fl-aws

Flaws at AWS
Apache License 2.0
15 stars 0 forks source link

DeletionPolicy is not respected for non-empty S3 Buckets #13

Open andreineculau opened 7 years ago

andreineculau commented 7 years ago

as per the docs "Only Amazon S3 buckets that are empty can be deleted. Deletion will fail for buckets that have contents." (even with DeletionPolicy is set to Delete).

why is it like that? I doubt that even AWS knows why. As the creator of that resource, good design says that I should be able to do anything I want with it. Can you imagine if your OS would implement a similar rule? "oh yeah, you created this folder, you have r/w permissions, but hey first delete every file one by one in this folder and then we'll let you delete the folder itself"

PS: the ridiculous situation gets even worse when the bucket is created as part of a cloudformation stack-create process - if the stack fails, then the bucket doesn't get deleted.