Aws-cdk: Security group as ingress rule source

Created on 8 Apr 2019  路  3Comments  路  Source: aws/aws-cdk

Is it possible to add a security group ID as the source for an ingress rule? See example below:

privateSecurityGroup.addIngressRule(new ec2.SecurityGroupId(publicSecurityGroup.securityGroupId), new ec2.TcpPort(22), 'Ingress SSH from public sg');

Most helpful comment

I believe the following should work:

privateSecurityGroup.connections.allowFrom(publicSecurityGroup, new ec2.TcpPort(22), 'Ingress SSH from public sg');

All 3 comments

I believe the following should work:

privateSecurityGroup.connections.allowFrom(publicSecurityGroup, new ec2.TcpPort(22), 'Ingress SSH from public sg');

@rix0rrr thank you for this!

Did it work?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eladb picture eladb  路  3Comments

abelmokadem picture abelmokadem  路  3Comments

NukaCody picture NukaCody  路  3Comments

schof picture schof  路  3Comments

peterdeme picture peterdeme  路  3Comments