What causes cdk bootstrap to hang?

Viewed 1582

I am trying to use the cdk bootstrap command.

>$env:CDK_NEW_BOOTSTRAP=1
>npx cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://1234.../us-east-1

I get the output:

CDK_NEW_BOOTSTRAP set, using new-style bootstrapping.
Bootstrapping environment aws://1234.../us-east-1...

I just hangs at this point. On one attempt I came back more than an hour later and it was still stuck. An s3 bucket with the prefix cdk did show up but has no files.

I've attempted to run it a few times but it's always the same.

What can cause it to get stuck this way?

Update

Based on the comment from vt102 I have obtained some error out from the command.

>$env:CDK_NEW_BOOTSTRAP=1
>npx cdk bootstrap --cloudformation-execution-policies --verbose --debug arn:aws:iam::aws:policy/AdministratorAccess aws://1234.../us-east-1

The output is now:

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))

That second line about the unstable stack repeats every couple of seconds.

I went into the AWS Console and looked under CloudFormation -> Stacks but there are no stacks listed. I attempted to change the status filter but nothing.

How can I find and delete this unstable stack and start again?

I recall when I first tried the cdk command I made syntax error in the account number and region. It got stuck and I killed it. That's probably when it got into this invalid state.

That

1 Answers

I got the exact same problem and was searching for a stack somewhere in the Management Console. After a long time of reinstalling, updating etc. I was fooled again by the Console. I checked for the stacks via the AWS CLI

aws cloudformation list-stacks --region eu-west-1 --profile account-id_AWSAdministratorAccess

I found a stack hiding from the Console

"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"
        }
    },

I could delete it via:

aws cloudformation delete-stack --stack-name CDKToolkit --region eu-west-1 --profile account-id_AWSAdministratorAccess

After that I could Bootstrap again

Related