I did some clean up in my S3 buckets and deleted S3 bucket with weird names. Now my CDK stacks are in weird states. I have some CDK stacks running.
$cdk ls
shows
LambdaHoroscrape
I destroy the stack with those commands
cdk destroy
cdk destroy LambdaHoroscrape
Are you sure you want to delete: LambdaHoroscrape (y/n)? y
LambdaHoroscrape: destroying...
LambdaHoroscrape: destroyed
However the stack LambdaHoroscrape is still present, cdk ls
confirms it.
How can I properly delete this CDK stack ?
Context: I wanted to delet the stack because my deployment ( cdk deploy
) showed this cryptic message
[%] fail: No bucket named 'cdktoolkit-stagingbucket-zd83596pa2cm'. Is account xxxxx bootstrapped?
I boostrapped my account with
cdk bootstrap aws://{account_number}/{region}
Others encountered this cryptic error as well https://github.com/aws/aws-cdk/issues/6808
In the end, because of this error and eagerness to destroy the stack, I lost my DynamoDB data collected since 2 weeks.
CodePudding user response:
The message is caused by the fact that you deleted the CDK asset bucket created during bootstrapping. You'll need to re-bootstrap your environment to deploy there.
As for deleting, CDK deploys cloudformation stacks, so a sure way to delete something is to go to the cloudformation console and delete the stack.