Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SecurityGroup: add support for adding Ingress Rules that reference Security Groups from a Peered VPC #7111

Closed
2 tasks
RolandOtta opened this issue Apr 1, 2020 · 9 comments
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@RolandOtta
Copy link

Use Case

we have multiple sub accounts that are connected with vpc peering.
we need to manage security-groups that reference security-groups from a peered account like it is possible in cloudformation with
SourceSecurityGroupOwnerId and
SourceSecurityGroupId in the AWS::EC2::SecurityGroup

from what i have seen so far this is not possible with the addIngressRule method of the ec2 securitygroup

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@RolandOtta RolandOtta added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Apr 1, 2020
@SomayaB SomayaB added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Apr 3, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Apr 16, 2020

This needs an additional implementation of IPeer.

@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md labels Apr 16, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label May 19, 2020
@rix0rrr rix0rrr added the p2 label Aug 12, 2020
@singlewind
Copy link

singlewind commented Nov 12, 2020

Can write like this

const incomingSecurityGroup = new SecurityGroup(
      this,
      "IncomingSecurityGroup",
      {
        vpc: imports.vpc,
        allowAllOutbound: true,
      }
    );

incomingSecurityGroup.addIngressRule(incomingSecurityGroup, Port.tcp(props.lokiHttpPort), 'Internal HTTP');
incomingSecurityGroup.addIngressRule(incomingSecurityGroup, Port.tcp(props.lokiGrpcPort), 'Internal GRPC');
incomingSecurityGroup.addIngressRule(incomingSecurityGroup, Port.tcp(props.lokiMemberlistPort), 'Internal Memberlist');

@dev-d
Copy link

dev-d commented Mar 1, 2021

Not sure how @singlewind 's solution solves the problem.

Tried using ec2.CfnSecurityGroupIngress - in theory it should work, but It did not.

@mikeatlas
Copy link

mikeatlas commented May 5, 2021

@dev-d Any luck since posting?
@rix0rrr I might be up for making said IPeer implementation PR...

@rix0rrr rix0rrr removed their assignment Jun 3, 2021
@singlewind
Copy link

Not sure how @singlewind 's solution solves the problem.

Tried using ec2.CfnSecurityGroupIngress - in theory it should work, but It did not.

Sorry, I misunderstood the problem.

jacobklitzke pushed a commit to jacobklitzke/aws-cdk that referenced this issue Dec 7, 2021
Allows users to add ingress/egress security group rules containing a security group id using the Peer interface.

Implements aws#7111
jacobklitzke pushed a commit to jacobklitzke/aws-cdk that referenced this issue Jan 3, 2022
Allows users to add ingress/egress security group rules containing a security group id using the Peer interface.

Implements aws#7111
jacobklitzke pushed a commit to jacobklitzke/aws-cdk that referenced this issue Jan 3, 2022
Allows users to add ingress/egress security group rules containing a security group id using the Peer interface.

Implements aws#7111
mergify bot pushed a commit that referenced this issue Jan 19, 2022
Allows users to add ingress/egress security group rules containing a security group id using the Peer interface.

Implements #7111


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Feb 21, 2022
Allows users to add ingress/egress security group rules containing a security group id using the Peer interface.

Implements aws#7111


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@therealvio
Copy link

Any updates on this?

Connecting vpc-peered security groups is something we are looking to do too :)

@BDeus
Copy link
Contributor

BDeus commented Sep 14, 2022

maybe it can be closed, because there are an implementation of Peer SG with another account ?
Peer.securityGroupId(sgId, accoungId)

@MrArnoldPalmer
Copy link
Contributor

This was solved by #18248, reopen if you're still having an issue. Thanks

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2
Projects
None yet
Development

No branches or pull requests

9 participants