Home > OS >  How to cleanup resources for AWS CDKToolkit stack
How to cleanup resources for AWS CDKToolkit stack

Time:10-08

When I run cdk bootstrap, AWS creates a stack named CDKToolkit. This comes with a bunch of IAM roles and S3 buckets for CDK to function properly. The problem is when I delete this stack in CloudFormation, the roles and buckets are not cleaned up even though the stack goes away. What is the right way to completely remove CDK from an AWS account?

CodePudding user response:

The only resource that's not removed when you destroy the stack is the asset bucket. This is expected - the right way to completely remove all the resources is to remove the asset bucket by hand afterwards.

You may also run into an issue when removing the ECR asset repository if it's not empty. In this case, you need to delete all the images in the repository by hand and re-run the stack removal.

  • Related