invoking add_ingress_rule() on an imported security group throws AttributeError: 'Resource' object has no attribute 'add_ingress_rule'
See original GitHub issueAfter upgrading CDK to v1.16.x and jsii to 0.20.3 today, add_ingress_rule() suddenly started throwing the below error when trying to add an inbound rule to an imported security group.
AttributeError: ‘Resource’ object has no attribute ‘add_ingress_rule’
Reproduction Steps
self._lambda_security_group = ec2.SecurityGroup.from_security_group_id(
self,
'sg1',
security_group_id='sg-xxxx'
)
self._lambda_security_group.add_ingress_rule(
ec2.Peer().prefix_list('sg-xxxx'),
ec2.Port.tcp(443),
description="Sample Ingress rule"
)
Error Log
Traceback (most recent call last):
File "app.py", line 30, in <module>
env=core.Environment(account=ES_DOMAIN_ARN.split(":")[4], region=ES_DOMAIN_ARN.split(":")[3])
File "/Users/aravraje/aws-solutions/aws-es-recommended-cw-alarms/.env/lib/python3.7/site-packages/jsii/_runtime.py", line 66, in __call__
inst = super().__call__(*args, **kwargs)
File "/Users/aravraje/aws-solutions/aws-es-recommended-cw-alarms/aws_es_recommended_cw_alarms/aws_es_recommended_cw_alarms_stack.py", line 23, in __init__
self, "aws-es-cw-alarms", domain_arn, aws_cli_profile, cw_trigger_sns_arn_list, enable_es_api_output, es_api_output_sns_arn
File "/Users/aravraje/aws-solutions/aws-es-recommended-cw-alarms/.env/lib/python3.7/site-packages/jsii/_runtime.py", line 66, in __call__
inst = super().__call__(*args, **kwargs)
File "/Users/aravraje/aws-solutions/aws-es-recommended-cw-alarms/aws_es_recommended_cw_alarms/aws_es_cw_alarms.py", line 220, in __init__
self._lambda_security_group.add_ingress_rule(
AttributeError: 'Resource' object has no attribute 'add_ingress_rule'
Environment
- CLI Version : 1.16.1 (build 9a5a761)
- Framework Version:
- OS : macOS Sierra
- Language : Python
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
Add Ingress Rule to Security Groups using AWS CDK
aws_ec2. However - when I try to deploy the stack, I get the following error : AttributeError: 'method' object has no attribute 'jsii__ ......
Read more >awslabs/aws-cdk - Gitter
I am looking for CI/CD setup for aws-cdk python project. I have api gateway + lambda functions + dynamodb and I am trying...
Read more >'Resource' object has no attribute 'urlcrawlerrorscounts'
Google Search Console - 'Resource' object has no attribute 'urlcrawlerrorscounts'. I am trying to use the googleapiclient library for python with my ...
Read more >RQs answer (3) - Zenodo
The pool does not exist or has not been authorized for use. ... Invalid attribute type error when trying to validate an object...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This appears to be fixed for me using aws-cdk 1.16.2 and jsii 0.20.5.
@tarunaroraonline I don’t think that’s the same error…