Make sure your stacks delete properly, AWS is usually pretty good in taking care for you, but some things are a little awkward. CloudFormation can’t delete S3 buckets or Elastic Container Registries if they are not empty – it nicely wipes RDS. You want to augment your CloudFormation setup with a few AWS CLI scripts that take care of that so using your “clean script” will leave no trash.

A note on versioned S3 buckets, you have to delete all versions and delete markers of objects before you can delete a versioned bucket. Here is a small snippet that will do that:

Example (keep in mind that you will get errors if there are no versions, delete markers, just ignore those):

Be the first to comment on "Cleanup"

Leave a comment

Your email address will not be published.