Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

CDK WorkShop Issue with cdk bootstrap command on Windows 7 Professional #173

Closed
SomayaB opened this issue Oct 26, 2020 · 4 comments
Closed
Labels
bug This issue is a bug. effort/medium Medium work item – a couple days of effort os/windows Related specifically to Windows behavior p2

Comments

@SomayaB
Copy link
Contributor

SomayaB commented Oct 26, 2020

❓ Guidance Question

Originally posted by @Blyseur in aws/aws-cdk#11010

In the CDK WorkShop, when we add our first lambda function, we have to import @aws-cdk/aws-lambda. Once, we write the code and we want to deploy, we have an error occured because of the bootstrapping

Reproduction Steps

On Windows, init a cdk project, follow the steps until arrived to the lambda function step.
https://cdkworkshop.com/20-typescript/30-hello-cdk/200-lambda.html

What did you expect to happen?

Deploy correctly CdkWorkshopStack

What actually happened?

We obtain an error, where it is sayed we must deployed the toolkit stack.

IAM Statement Changes
┌───┬─────────────────────────────────┬────────┬────────────────┬──────────────────────────────┬───────────┐
│   │ Resource                        │ Effect │ Action         │ Principal                    │ Condition │
├───┼─────────────────────────────────┼────────┼────────────────┼──────────────────────────────┼───────────┤
│ + │ ${HelloHandler/ServiceRole.Arn} │ Allow  │ sts:AssumeRole │ Service:lambda.amazonaws.com │           │
└───┴─────────────────────────────────┴────────┴────────────────┴──────────────────────────────┴───────────┘
IAM Policy Changes
┌───┬─────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐
│   │ Resource                    │ Managed Policy ARN                                                             │
├───┼─────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ + │ ${HelloHandler/ServiceRole} │ arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole │
└───┴─────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Do you wish to deploy these changes (y/n)? y
CdkWorkshopStack: deploying...

 CdkWorkshopStack failed: Error: This stack uses assets, so the toolkit stack must be deployed to the environment (Run "cdk bootstrap aws://unknown-account/unknown-region")
    at Object.addMetadataAssetsToManifest (C:\Users\Toto\AppData\Roaming\npm\node_modules\aws-cdk\lib\assets.ts:27:11)
    at Object.deployStack (C:\Users\Toto\AppData\Roaming\npm\node_modules\aws-cdk\lib\api\deploy-stack.ts:207:29)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at CdkToolkit.deploy (C:\Users\Toto\AppData\Roaming\npm\node_modules\aws-cdk\lib\cdk-toolkit.ts:180:24)
    at initCommandLine (C:\Users\Toto\AppData\Roaming\npm\node_modules\aws-cdk\bin\cdk.ts:197:9)
This stack uses assets, so the toolkit stack must be deployed to the environment (Run "cdk bootstrap aws://unknown-account/unknown-region")

So, at this moment, we run cdk bootstrap and an other error occured :

 ⏳  Bootstrapping environment aws://unknown-account/unknown-region...
 ❌  Environment aws://unknown-account/unknown-region failed bootstrapping: [Error: ENOENT: no such file or directory, mkdtemp 'C:\Users\Toto\Documents\cdk-workshop\ASIA......\........\......\......\......\......\......\......\......\......\......\cdk-bootstrapXXXXXX'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'mkdtemp',
  path: 'C:\\Users\\Toto\\Documents\\cdk-workshop\\ASIA......\......\\......\\......\......\\......\\......\\......\\......\\......\\......\\......\\......\\......\\......\\cdk-bootstrapXXXXXX'
}
ENOENT: no such file or directory, mkdtemp 'C:\\Users\\Toto\\Documents\\cdk-workshop\\ASIA......\......\\......\\......\......\\......\\......\\......\\......\\......\\......\\......\\......\\......\\......\\cdk-bootstrapXXXXXX'

Environment

  • CLI Version : aws-cli/1.18.160
  • Framework Version:
  • Node.js Version: v12.14.0
  • OS : Windows 7 Professional
  • Language (Version):

Other information

@SomayaB SomayaB added needs-triage This issue or PR still needs to be triaged. guidance Question that needs advice or information. labels Oct 26, 2020
@SomayaB SomayaB self-assigned this Oct 26, 2020
@SomayaB
Copy link
Contributor Author

SomayaB commented Oct 26, 2020

Hi @Blyseur, did you provide the environment (account and region) you want to deploy to? This can be done 3 ways.

  1. Directly in the command cdk bootstrap aws://ACCOUNT-NUMBER/REGION.

  2. Storing it in your aws profile and then using the basic cdk bootstrap command.

  3. Using environment variables and then again using the basic cdk bootstrap command.

You can read more about bootstrapping here.
Key section:

If you do not specify at least one environment in the cdk bootstrap command, the AWS CDK Toolkit synthesizes the AWS CDK app in the current directory and bootstraps all the environments referenced in the app. If a stack is environment-agnostic (that is, it does not have an env property), the CDK's environment (for example, the one specified using --profile, or the default AWS environment otherwise) is applied to make the stack environment-specific, and that environment is then bootstrapped.

@SomayaB SomayaB added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 26, 2020
@Blyseur
Copy link

Blyseur commented Oct 27, 2020

Hi @SomayaB yes, I did and I tried it with the same configuration on Linux, it worked correctly.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Oct 28, 2020
@SomayaB SomayaB added bug This issue is a bug. and removed guidance Question that needs advice or information. labels Nov 2, 2020
@SomayaB SomayaB assigned NGL321 and unassigned SomayaB Nov 2, 2020
@SomayaB SomayaB added the os/windows Related specifically to Windows behavior label Nov 2, 2020
@NGL321 NGL321 added effort/medium Medium work item – a couple days of effort p2 labels Jan 4, 2021
@NGL321 NGL321 removed their assignment Jul 19, 2021
@peterwoodworth
Copy link
Contributor

This isn't an issue with the workshop, if you're still having trouble with this please open an issue on the main repo

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. effort/medium Medium work item – a couple days of effort os/windows Related specifically to Windows behavior p2
Projects
None yet
Development

No branches or pull requests

4 participants