从 cloudformation 中删除 CDKToolkit 堆栈并尝试使用以下命令重新创建它之后
cdk bootstrap --profile stage-profile
命令抛出错误
⏳ 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.
尝试删除 CDKToolkit 堆栈的 S3 存储桶,这解决了我的问题。
cdk IAM 角色缺少创建 CDKToolKit 所需资源的管理员访问权限。将管理策略附加到角色后
cdk bootstrap --profile stage-profile
工作了
就我而言,我手动删除了堆栈,但我还必须删除“cdk-XXXX...”S3 存储桶(然后删除 CloudFormation 堆栈),以便能够再次引导