3

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

Matthew MacFarland
  • 2,413
  • 3
  • 26
  • 34
  • 1
    What does a process manager show? On Windows you can check Process Explorer. On Linux you can use `ps aux -Hww`. On Mac OS X, htop in tree mode (F5) will help. If it's already creating the CDKToolkit stack, what is its status? – kichik Aug 29 '21 at 20:03
  • 2
    cdk has `--verbose` and `--debug` flags. Run with those and check its output. – vt102 Aug 30 '21 at 03:14
  • Check the Cloud Formation web gui, it will show where it's getting stuck. – gshpychka Aug 30 '21 at 07:10
  • @vt102 That's a great idea. When I add the --verbose --debug flags it reveals the problem. `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)).` I'll try to figure out how to clear that in the AWS console and then try again. – Matthew MacFarland Aug 30 '21 at 11:56
  • 1
    Refer to the manual step described here: https://stackoverflow.com/a/71462906/6134928 – OSGI Java Mar 20 '22 at 22:19

1 Answers1

5

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

Oliver
  • 66
  • 1
  • 2