A few months ago I played around with AWS CDK and so I of course did the cdk bootstrap
.
At that time I stopped playing around and thought I'd never use it again. Having a kind of neatly attitude in this kind of things (and missing an undo or delete option being delivered with the cdk itself :/ ) I deleted all cdk objects from my account.
Or at least I thought so, because now (starting to play around again), calling cdk bootstrap
does "nothing":
✅ Environment aws://xxxxxxxxx/eu-central-1 bootstrapped (no changes).
But trying to cdk deploy
gives me:
fail: No bucket named 'cdk-XXXXXXXXXXX-eu-central-1'. Is account XXXXXXXXXXXX bootstrapped?
Well yes right...I don't have any buckets at all at the moment.
Is there a way to cdk bootstrap --force
that I'am missing? Is there a list of all objects I should have deleted? I find a lot suggestions for people having problems with their stacks, but I have no idea how to fix this.
Edit: I just "solved" the problem, by creating a bucket with the given cryptic name...but that doesn't feel right. So I leave this Question open, to see if there is a better way to do it.
CodePudding user response:
Bootstrapping creates a Stack called CDKToolkit
, which has the CloudFormation resources CDK needs to deploy. You can safely "uninstall-reinstall" it:
aws cloudformation delete-stack --stack-name CDKToolkit
cdk bootstrap
Note: "Drift" is the technical term for your problem. The actual AWS resource state "drifted" from the expected state defined in the CDKToolkit
CloudFormation template. CloudFormation has tools to deal with the drift problem. You can report on drift, for instance:
aws cloudformation detect-stack-drift --stack-name CDKToolkit