StagingBucket already exists error during cdk Bootstrap


During my practice of fllowing the AWS Cloud Development Kit (AWS CDK) script that automatically provisions container
image-based Lambda functions that perform ML inference using pre-trained Hugging Face modelsWhen using the aws cdk stack deployment,
I got some error like this:

1:45:26 AM CREATE_FAILED        | AWS::S3::Bucket       | StagingBucket
cdk-hnb659fds-assets-xxxxxxxxxxx-us-east-1 already exists

Environment aws://xxxxxxxxx/us-east-1 failed bootstrapping: Error:
The stack named CDKToolkit failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE:
cdk-hnb659fds-assets-xxxxxxx-us-east-1 already exists

As a reminder, here are the steps I was doing:

cdk bootstrap
cdk deploy

When I reach the cdk bootstrap I get the above error:

The error happens probably because I previously mannually removed some images on the aws ECR.
So to fix that error, first I go to the aws console and find the CloudFormation dashboard, and delete the stack called “CDKToolkit”,
shown as below

lift plot

Then I went to S3 buckets in aws console, and delete the bucket named as “cdk-hnb659fds-assets-xxxxxxxxxxx-us-east-1”, as shown below:

lift plot

After it’s done, I rerun cdk bootstrap, it works.


Author: robot learner
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source robot learner !
  TOC