Interview Prep/AWS/Observability, Secrets, KMS and CloudFormation

Stack deletion fails because a bucket is not empty. How do you handle it?

IntermediateScenarioObservability, Secrets, KMS and CloudFormation
Answer

Situation read → CloudFormation will not delete non-empty buckets.

What I'd do →

  1. Empty: aws s3 rm s3://b --recursive, versioned buckets need s3api delete-objects for versions
  2. Retry delete
  3. Or use a custom resource that empties on delete
  4. Use Retain for important buckets

Why → Safety prevents accidental data loss.

Interview tip → Versioned buckets also need markers removed.

aws All AWS questions

More on Observability, Secrets, KMS and CloudFormation