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

(aws-elasticloadbalancingv2): (network-load-balancer-supports-security-groups) #26735

Closed
2 tasks
neilkuan opened this issue Aug 12, 2023 · 6 comments · Fixed by #27978 or #28494 · May be fixed by stack-spot/app-handler-functions-template#2, stack-spot/eks-env-ts-template#2 or stack-spot/web-react-deploy#4
Labels
@aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@neilkuan
Copy link
Contributor

neilkuan commented Aug 12, 2023

Describe the feature

https://aws.amazon.com/tw/about-aws/whats-new/2023/08/network-load-balancer-supports-security-groups/
network load balancer supports security groups.

Use Case

Supports create NLB with SG via aws cdk L2.

Proposed Solution

Support securityGroup into NetworkLoadBalancerProps.

Other Information

No response

Acknowledgements

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

CDK version used

2.91.0

Environment details (OS name and version, etc.)

macOS Ventura 13.4.1

@neilkuan neilkuan added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 12, 2023
@github-actions github-actions bot added the @aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 label Aug 12, 2023
@neilkuan
Copy link
Contributor Author

I can use addPropertyOverride() setting SecurityGroups for now.

const lb = new elasticloadbalancingv2.NetworkLoadBalancer(this, 'nyancatNlb', {
      vpc,
      internetFacing: true,
      crossZoneEnabled: true,
    });
    const ntg80 = lb.addListener('Listener80', { port: 80 });
    ntg80.addTargets('svc80', {
      port: 80,
      targets: [svc],
    });
    const nlbSg = new ec2.SecurityGroup(this, 'NLBSecurityGroup', { vpc, allowAllOutbound: true });
    svc.connections.allowFrom(nlbSg, ec2.Port.tcp(80));
    const cfnlb = (lb.node.defaultChild as elasticloadbalancingv2.CfnLoadBalancer );
    cfnlb.addPropertyOverride('SecurityGroups', [
      nlbSg.securityGroupId,
    ]);

@pahud
Copy link
Contributor

pahud commented Aug 14, 2023

Awesome @neilkuan ! This is a huge update from NLB! Can't wait to see it in CDK.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Aug 14, 2023
@vumdao
Copy link

vumdao commented Sep 11, 2023

Hope to see this release soon!

@amouly
Copy link

amouly commented Sep 14, 2023

Looking for this feature too! Thanks for documenting it!

mikewrighton added a commit to msambol/aws-cdk that referenced this issue Nov 14, 2023
mikewrighton added a commit to msambol/aws-cdk that referenced this issue Nov 15, 2023
vinayak-kukreja added a commit to msambol/aws-cdk that referenced this issue Nov 20, 2023
mergify bot added a commit to msambol/aws-cdk that referenced this issue Nov 21, 2023
@mergify mergify bot closed this as completed in #27978 Nov 21, 2023
mergify bot pushed a commit that referenced this issue Nov 21, 2023
)

Closes #26735.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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.

@ZhouLihua
Copy link

For some one who uses CDK python launguage.
nlb.node.default_child.add_property_override("SecurityGroups", [ nlb_sg.security_group_id ])

mergify bot pushed a commit that referenced this issue Jan 16, 2024
# Summary
Implement an `IConnectable` interface to a NetworkLoadBalancer. 

# Why need this change?
AWS CDK has great features for abstraction. `IConnectable` interface is one of this. `IConnectable` simplifies the management of security groups. AWS CDK add support security group to NLB at #27978. However, Currently NLB not implement `IConnectable`, so customers can't use useful interface in AWS CDK.

# Example use case

```ts
declare const lb: elbv2.NetworkLoadBalancer;
declare const asg: autoscaling.AutoScalingGroup;

asg.connections.allowFrom(lb, ec2.Port.tcp(8088)); // currently can not
```

Closes #26735

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment