Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error running prereq script #3

Open
neohed opened this issue Jun 3, 2023 · 1 comment
Open

Error running prereq script #3

neohed opened this issue Jun 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@neohed
Copy link

neohed commented Jun 3, 2023

Describe the bug
Running cdk deploy creates error:

Traceback (most recent call last):
  File "D:\Temp\Security\106-Connecting-to-EC2-Instances-Using-Session-Manager\cdk-AWS-Cookbook-106\app.py", line 10, in <module>
    CdkAwsCookbook106Stack(app, "cdk-aws-cookbook-106",
  File "D:\Temp\Security\106-Connecting-to-EC2-Instances-Using-Session-Manager\cdk-AWS-Cookbook-106\.venv\lib\site-packages\jsii\_runtime.py", line 112, in __call__
    inst = super().__call__(*args, **kwargs)
  File "D:\Temp\Security\106-Connecting-to-EC2-Instances-Using-Session-Manager\cdk-AWS-Cookbook-106\cdk_aws_cookbook_106\cdk_aws_cookbook_106_stack.py", line 18, in __init__
    subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
  File "C:\Users\dave\AppData\Local\Programs\Python\Python310\lib\enum.py", line 437, in __getattr__
    raise AttributeError(name) from None
AttributeError: PRIVATE_ISOLATED

Subprocess exited with error 1
(.venv)

Desktop (please complete the following information):

  • OS: Windows 10

Is this an easy fix? Alternatively, is there a way to just use CloudFormation templates from the AWS console? I'm not a Python developer so don't know how to resolve this.

@neohed neohed added the bug Something isn't working label Jun 3, 2023
@hikiko999
Copy link

hikiko999 commented Feb 18, 2024

I'm running CDK on Lubuntu 22.04.3. I'm using a virtualenv environment. I had the same issue. I did the following to fix it. Make sure you're in venv mode and in the root directory for the code. (This is after following all the steps in the guide right before cdk deploy).

  1. The code in the repo uses "aws-cdk-lib==2.0.0-rc.21". You have to upgrade this to the latest version. (2.128.0 (build d995261)) is working for me.
    pip install --upgrade aws-cdk-lib
  2. You have to bootstrap CDK. This will create a bucket and CloudFormation stack in your AWS account.
    cdk bootstrap
  3. You just then have to deploy.
    cdk deploy

To clean up the bootstrap. You can refer to here. You can keep it for future CDK use though. Albeit late, I hope this also helps others.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants