-
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
feat(elbv2): Implement IConnectable to NLB #28494
feat(elbv2): Implement IConnectable to NLB #28494
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts
Show resolved
Hide resolved
securityGroups: Lazy.list({ | ||
produce: () => this.connections.securityGroups.length >= 1 ? this.connections.securityGroups.map(sg => sg.securityGroupId) : undefined, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If securityGroups
becomes an empty array from undefined, an update will be applied and deployment will not be possible, so in the case of an empty array, it is undefined for backwards compatibility.
ref: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-security-groups.html#security-group-considerations
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
const backend = new elbv2.ApplicationLoadBalancer(stack, 'Backend', { | ||
vpc, | ||
}); | ||
backend.addListener('Listener', { | ||
protocol: elbv2.ApplicationProtocol.HTTP, | ||
defaultAction: elbv2.ListenerAction.fixedResponse(200, { | ||
contentType: 'application/json', | ||
messageBody: JSON.stringify({ | ||
Message: 'I am ALB!', | ||
}), | ||
}), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed target to ALB from IP to test reachability client -> nlb -> backend. This test can check security group settings via http api call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
I left some suggestions for adjustments, feel free to comment on those.
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts
Show resolved
Hide resolved
…k-load-balancer.ts Co-authored-by: Luca Pizzini <[email protected]>
…balancer.test.ts Co-authored-by: Luca Pizzini <[email protected]>
…balancer.test.ts Co-authored-by: Luca Pizzini <[email protected]>
…k-load-balancer.ts Co-authored-by: Luca Pizzini <[email protected]>
@lpizzinidev Thanks your reviewing!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
I left some comments for a final cleanup and adjustments.
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
Outdated
Show resolved
Hide resolved
…k-load-balancer.ts Co-authored-by: Luca Pizzini <[email protected]>
…k-load-balancer.ts Co-authored-by: Luca Pizzini <[email protected]>
…k-load-balancer.ts Co-authored-by: Luca Pizzini <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
…after initialization
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @WinterYukky! This will be a very useful addition for the community.
As always, thanks for reviewing @lpizzinidev!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @WinterYukky! This will be a very useful addition for the community.
As always, thanks for reviewing @lpizzinidev!
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
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 implementIConnectable
, so customers can't use useful interface in AWS CDK.Example use case
Closes #26735
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license