-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
(aws-ecs): Improve confusing Connections
documentation/implementation
#17269
Comments
This isn't the first time I've seen this bug report - check out #16117 I'm not sure how the connections object is intended to be used for this use case, so my theory posted in the original issue could be incorrect. Either way, this issue is confusing and our docs should be more clear if this isn't just a bug. @madeline-k could you take a look at this? |
Another more elegant workaround: |
@peterwoodworth, I agree with what you said here. And this is the same scenario, just with a different construct. But I also agree this is confusing and we could consider either changing how the connections objects work on all constructs or changing the documentation. @matsaune Thanks for opening this issue and providing the workaround! |
Oh, and this is happening with the underlying |
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
This is still an issue. |
Connections
documentation/implementation
What is the problem?
Hi, I am using a ecsPatterns.NetworkLoadBalancedFargateService and tried to add a SecurityGroup in order to allow connections from NLB to fargate service. However this sg was not added as I expected to the fargateService.
Reproduction Steps
Define an ecsPatterns.NetworkLoadBalancedFargateService and add the following:
const securityGroupNotAdded = new ec2.SecurityGroup(this,"NblSecurityGroupNotAddedToService", { vpc: coreVpc, description: "Security group for connections from NLB to FargateService" }); securityGroupNotAdded.addIngressRule(ec2.Peer.ipv4(coreVpc.vpcCidrBlock),ec2.Port.tcp(80),"Allow from anyone in VPC on 80");
/** Somehow this does not get added. Seems like ony one sg allowed for fg service **/ loadBalancedFargateService.service.connections.addSecurityGroup(securityGroupNotAdded);
What did you expect to happen?
I expected this to be added to the SecurityGroups [] of the NetworkConfiguration of the Fargate service in order to allow connections from NLB.
What actually happened?
The sg is defined in cloudformation template but not registered in the SecurityGroups [] of the NetworkConfiguration of the Fargate service.
If this is a bug or a feature I do not know, but if feature and only allowed with one sg on fargate service it should be documented
CDK CLI Version
1.127.0 (build 0ea309a)
Framework Version
No response
Node.js Version
v16.4.2
OS
macOS 12.0.1 (21A559)
Language
Typescript
Language Version
Typescript Version 3.9.10
Other information
The workaround I use is as follows:
const securityGroup = loadBalancedFargateService.service.connections.securityGroups[0]; securityGroup.addIngressRule(ec2.Peer.ipv4(coreVpc.vpcCidrBlock),ec2.Port.tcp(80),"Allow from anyone in VPC on 80");
The text was updated successfully, but these errors were encountered: