I unwittingly deleted the CdkStack
in CloudFormation, but re-running cdk bootstrap
again resulted in an error telling me that the S3 bucket used by CDK already existed but wasn’t in my account.
This is because it may take up to an hour for a deleted S3 bucket name to become available to use again.
I solved the error by passing in the --qualifier
command line argument to cdk bootstrap
and then modifying the bootstrapQualifier
property in my cdk.json
file:
cdk bootstrap --qualifier MYQUALIFIER
The custom qualifier you put in must be all alphanumeric and no more than 10 characters.
After using that bootstrap command, I had to override the default qualifier used by the CDK Stack during synthesis by modifying the cdk.json file:
{
"app": "...",
"context": {
"@aws-cdk/core:bootstrapQualifier": "MYQUALIFIER"
}
}
Thankfully, all of this was documented here in the AWS docs.