arkime / aws-aio

Apache License 2.0
8 stars 3 forks source link

`cdk bootstrap` failing due to missing ENV vars #150

Closed chelma closed 7 months ago

chelma commented 7 months ago

Description

When performing a manual cdk bootstrap, the CDK CLI seems to be looking for the ENV variable set/configured by the Arkime AWS AIO CLI, resulting in the command failing:

(.venv) chelma@3c22fba4e266 aws-aio % cdk bootstrap
/Users/chelma/workspace/Arkime/aws-aio/cdk-lib/core/context-wrangling.ts:57
        throw Error(`Management Command not defined; expected to pull it from the CDK Context variable ${CDK_CONTEXT_CMD_VAR}`);
              ^
Error: Management Command not defined; expected to pull it from the CDK Context variable ARKIME_CMD
    at validateArgs (/Users/chelma/workspace/Arkime/aws-aio/cdk-lib/core/context-wrangling.ts:57:15)
    at Object.getCommandParams (/Users/chelma/workspace/Arkime/aws-aio/cdk-lib/core/context-wrangling.ts:32:12)
    at Object.<anonymous> (/Users/chelma/workspace/Arkime/aws-aio/cdk-lib/cloud-demo.ts:19:137)
    at Module._compile (node:internal/modules/cjs/loader:1255:14)
    at Module.m._compile (/Users/chelma/workspace/Arkime/aws-aio/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/chelma/workspace/Arkime/aws-aio/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)

NOTICES         (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)

25714   (cli) cdk deploy fails when stacks or stages share assets

        Overview: A single asset used in two stacks or stages that depend on
                  each other causes 'cdk deploy' to exit early.

        Affected versions: cli: >=2.80.0 <2.83.1

        More information at: https://github.com/aws/aws-cdk/issues/25714

If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 25714".
Subprocess exited with error 1
chelma commented 7 months ago

I'm pretty sure the README is just out of date, as the code indicates [1] we'll bootstrap the region automatically if the deployment as part of cluster-create fails because it hasn't been done.

[1] https://github.com/arkime/aws-aio/blob/main/manage_arkime/cdk_interactions/cdk_client.py#L66-L75

chelma commented 7 months ago

Yeah, confirmed - we do kick off the bootstrap if it hasn't been done. The README is out of date, will fix.

2024-01-17 08:01:31 - Executing command: deploy MyCluster-CaptureBucket MyCluster-CaptureNodes MyCluster-CaptureVPC MyCluster-OSDomain MyCluster-ViewerNodes
2024-01-17 08:01:31 - NOTE: This operation can take a while.  You can 'tail -f' the logfile to track the status.
2024-01-17 08:03:16 - The AWS Account/Region does not appear to be CDK Bootstrapped, which is required for deployment.  Attempting to bootstrap now...
2024-01-17 08:03:16 - Executing command: bootstrap aws://XXXXXXXXXXXX/ap-southeast-2
2024-01-17 08:03:16 - NOTE: This operation can take a while.  You can 'tail -f' the logfile to track the status.
2024-01-17 08:04:46 - Bootstrap succeeded
2024-01-17 08:04:46 - Executing command: deploy MyCluster-CaptureBucket MyCluster-CaptureNodes MyCluster-CaptureVPC MyCluster-OSDomain MyCluster-ViewerNodes
chelma commented 7 months ago

Code merged; issues should be resolved. Closing.