Aws-cdk: type object 'Vpc' has no attribute 'fromLookup'

Created on 9 Jan 2020  路  6Comments  路  Source: aws/aws-cdk

Reproduction Steps

from aws_cdk import (
core,
aws_ec2 as ec2
)

class Ec2Stack(core.Stack):

def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
    super().__init__(scope, id, **kwargs)

    # Get details of vpc, name:np
    vpc = ec2.Vpc.fromLookup(self, 'VPC', {
      isDefault: True
    });

Error Log

Traceback (most recent call last):
File "app.py", line 9, in
Ec2Stack(app, "ec2")
File ".../ec2/.env/lib/python3.8/site-packages/jsii/_runtime.py", line 66, in __call__
inst = super().__call__(args, *kwargs)
File ".../ec2/ec2_stack.py", line 12, in __init__
vpc = ec2.Vpc.fromLookup(self, 'VPC', {
AttributeError: type object 'Vpc' has no attribute 'fromLookup'

Environment

  • **CLI Version : aws-cli/1.16.294
  • **Framework Version: 1.19.0 (build 5597bbe)
  • **OS : Linux/4.4.0-17763-Microsoft (WSL)
  • **Language :Python

Other


This is :bug: Bug Report

causpython-no-types guidance

All 6 comments

@riponbanik try Vpc.from_lookup :)

@skinny85 Thanks. Why the props are different than the typescript one?

@skinny85 Thanks. Why the props are different than the typescript one?

Property names follow the conventions of the native languages. Python uses snake_case for method names, hence fromLookup becomes from_lookup.

Closing this issue since it seems to have been resolved. Feel free to reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ababra picture ababra  路  3Comments

kawamoto picture kawamoto  路  3Comments

NukaCody picture NukaCody  路  3Comments

nzspambot picture nzspambot  路  3Comments

v-do picture v-do  路  3Comments