Skip to main content

Stack Deletion

Stack deletions often fail because a resource managed by the corresponding CloudFormation stack could not be deleted.
First, we need to check what error was returned from CloudFormation.
Below are solutions for some common resource-deletion errors:

Bucket is not empty

Error: "The bucket you tried to delete is not empty (Service: Amazon S3; Status Code: 409; Error Code: BucketNotEmpty)"

bucket-is-not-empty

Reason: The S3 Bucket must not contain any objects (files or directories) in order to be deleted.
Solution: Open deployed stack in AWS console, go to S3 buckets that could not be deleted, and delete all files and directories in it.

bucket-emptying

Api Gateway custom domain names

Error: "Deleting stage Prod failed. Please remove all base path mappings related to the stage in your domains: prefix.yourdomain.com"

api

Reason: This happens if a user attached a custom domain name to the API Gateway.
Solution:

  1. Open the stack in the AWS console.
  2. Switch to the Resources tab, and locate ApiGateway which failed to be deleted.
  3. Copy the domain name of the API that had the error.
  4. Open the API Gateway page in the AWS console.
  5. Switch to the "Custom Domain Names" tab and locate the problematic domain name.

You have 2 options depending on your project architecture:

  • Remove the link to the API gateway.
    1. In the domain name details window, switch to "Configure API mapping"
    2. Delete the link
  • Delete the domain name

bucket-emptying

Ready to Get Started?

Get Started for Free
© 2023 Altostra, Inc.