How can I connect two security groups together using the AWS CDK?
This is an example of allow IPv4 traffic ingress via port 443
ec2SecurityGroup.addIngressRule(Peer.anyIpv4(), Port.tcp(443), 'Test rule', false)
This from the documentation:
public addIngressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean): void
This is the best I could come up with (where 'elbSecurityGroup' is another security group):
const p = Peer.anyIpv4()
p.connections.allowFrom(elbSecurityGroup.connections, Port.tcp(443))
ec2SecurityGroup.addIngressRule(p, Port.tcp(443), 'Test rule', false)
But that doesn't really make any sense. There must be a better way of Initializing the Peer. Typescript says
Constructor of class 'Peer' is protected and only accessible within the class declaration.
If I try:
const p = new Peer()