是什么导致 cdk bootstrap 挂起?

Mat*_*and 3 amazon-web-services aws-cdk

我正在尝试使用 cdk bootstrap 命令。

>$env:CDK_NEW_BOOTSTRAP=1
>npx cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://1234.../us-east-1
Run Code Online (Sandbox Code Playgroud)

我得到输出:

CDK_NEW_BOOTSTRAP set, using new-style bootstrapping.
Bootstrapping environment aws://1234.../us-east-1...
Run Code Online (Sandbox Code Playgroud)

我现在只是挂着。有一次我一个多小时后回来尝试,但它仍然卡住了。带有前缀 cdk 的 s3 存储桶确实出现了,但没有文件。

我尝试运行它几次,但总是一样。

什么会导致它陷入这样的困境?

更新

根据 vt102 的评论,我从命令中发现了一些错误。

>$env:CDK_NEW_BOOTSTRAP=1
>npx cdk bootstrap --cloudformation-execution-policies --verbose --debug arn:aws:iam::aws:policy/AdministratorAccess aws://1234.../us-east-1
Run Code Online (Sandbox Code Playgroud)

现在的输出是:

Waiting for stack CDKToolkit to finish creating or updating...
Stack CDKToolkit has an ongoing operation in progress and is not stable (REVIEW_IN_PROGRESS (User Initiated))
Run Code Online (Sandbox Code Playgroud)

关于不稳定堆栈的第二行每隔几秒就会重复一次。

我进入 AWS 控制台并在 CloudFormation -> Stacks 下查看,但没有列出任何堆栈。我尝试更改状态过滤器,但没有任何效果。

如何找到并删除这个不稳定的堆栈并重新开始?

我记得当我第一次尝试 cdk 命令时,我在帐号和区域中出现了语法错误。它被卡住了,我杀了它。那可能就是它进入无效状态的时候。

小智 5

我遇到了完全相同的问题,并且正在管理控制台中的某个位置搜索堆栈。经过很长时间的重新安装、更新等,我再次被控制台愚弄了。我通过 AWS CLI 检查了堆栈

aws cloudformation list-stacks --region eu-west-1 --profile account-id_AWSAdministratorAccess
Run Code Online (Sandbox Code Playgroud)

我发现控制台隐藏了一个堆栈

"StackSummaries": [
    {
        "StackId": "arn:aws:cloudformation:eu-west-1:account-id:stack/CDKToolkit/some-uuid",
        "StackName": "CDKToolkit",
        "TemplateDescription": "This stack includes resources needed to deploy AWS CDK apps into this environment",
        "CreationTime": "2021-12-13T15:16:34.541000+00:00",
        "LastUpdatedTime": "2021-12-13T15:16:40.397000+00:00",
        "DeletionTime": "2021-12-13T15:23:40.728000+00:00",
        "StackStatus": "DELETE_IN_PROGRESS",
        "DriftInformation": {
            "StackDriftStatus": "NOT_CHECKED"
        }
    },
Run Code Online (Sandbox Code Playgroud)

我可以通过以下方式删除它:

aws cloudformation delete-stack --stack-name CDKToolkit --region eu-west-1 --profile account-id_AWSAdministratorAccess
Run Code Online (Sandbox Code Playgroud)

之后我可以再次启动