aws-cdk

CDKToolkit failed creation


After removing the CDKToolkit stack from cloudformation and trying to recreate it with cdk bootstrap --profile stage-profile command throws an error

⏳  Bootstrapping environment aws://123456/eu-central-1...
Trusted accounts for deployment: (none)
Trusted accounts for lookup: (none)
Using default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.
CDKToolkit: creating CloudFormation changeset...
4:11:35 PM | CREATE_FAILED        | AWS::SSM::Parameter   | CdkBootstrapVersion
ERROR Parameter Name /cdk-bootstrap/******/version with a different configuration already exists.

❌  Environment aws://123456/eu-central-1 failed bootstrapping: Error: The stack named CDKToolkit failed creation, 
it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: ERROR Parameter Name /cdk-bootstrap/******/version with a different configuration already exists.
   at prepareAndExecuteChangeSet (/usr/local/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:386:13)
   at processTicksAndRejections (node:internal/process/task_queues:95:5)
   at /usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:621:24
   at async Promise.all (index 0)
   at CdkToolkit.bootstrap (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:618:5)
   at initCommandLine (/usr/local/lib/node_modules/aws-cdk/lib/cli.ts:349:12)

The stack named CDKToolkit failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: ERROR Parameter Name /cdk-bootstrap/*****/version with a different configuration already exists.

Solution

  • The cdk IAM role was missing the admin access to create the resources needed by the CDKToolKit. After I attached the admin policy to the role the cdk bootstrap --profile stage-profile worked