Skip to content

fargate-load-balanced-service with default VPC error #399

@smart-patrol

Description

@smart-patrol

❓ Guidance Question

The Question

I am using the fargate-load-balanced-service template but with one modification, using the default vpc.

So for the VPC portion that means:
vpc = ec2.Vpc.from_lookup(self, "default_vpc", is_default=True)

with finally at the end

    env={
        "account": os.environ["CDK_DEFAULT_ACCOUNT"],
        "region": os.environ["CDK_DEFAULT_REGION"],
    },

Otherwise, not changes were made. Despite threads on StackOverflow showing otherwise, I get the following error:

Traceback (most recent call last):
  File "app.py", line 43, in <module>
    FargateCDK(
  File "/fargate/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 83, in __call__
    inst = super().__call__(*args, **kwargs)
TypeError: __init__() missing 1 required positional argument: 'scope'

Any idea why this is happening?

Environment

  • CDK CLI Version: 1.94
  • Example: fargate-load-balanced-service
  • Example Version: e2cc15c
  • OS: OSX Catalina
  • Language: Python

Other information

https://stackoverflow.com/questions/58726890/unable-to-import-vpc-in-aws-cdk

Also tried using core.Environment(account_id, region)

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions