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
});
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'
This is :bug: Bug Report
@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.
for more multiple languages example
https://docs.aws.amazon.com/cdk/latest/guide/multiple_languages.html
Closing this issue since it seems to have been resolved. Feel free to reopen.