I'm trying to add an ingress rule to a Security Group via the AWS CDK using Python. As per the documentation here - there's a method add_ingress_rule() on the Class aws_cdk.aws_ec2.
However - when I try to deploy the stack, I get the following error :
AttributeError: 'method' object has no attribute 'jsii__type' Subprocess exited with error 1
Security Group Code snippet below-
sg_elb = ec2.SecurityGroup(
self,
id = "sg_elb",
vpc = vpc,
security_group_name = "sg_elb"
)
sg_elb.add_ingress_rule(
peer = ec2.Peer.any_ipv4,
connection = ec2.Port.tcp(443) # This line seems to be a problem.
)
There's even the same example (in TypeScript) given on the official documentation here so I'm not sure what I'm doing wrong.
Can anyone advise ?
Thanks in advance !