-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(elasticloadbalancingv2): subnet mappings for network load balancer #33736
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
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.
(This review is outdated)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33736 +/- ##
=======================================
Coverage 83.98% 83.98%
=======================================
Files 120 120
Lines 6976 6976
Branches 1178 1178
=======================================
Hits 5859 5859
Misses 1005 1005
Partials 112 112
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
if (props.internetFacing !== true && props.subnetMappings.some(sm => sm.allocationId !== undefined)) { | ||
throw new ValidationError('Cannot specify `allocationId` for a internal load balancer.', this); | ||
} |
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.
This setting causes deployment failure.
Resource handler returned message: "Elastic IPs are not supported for load balancers with scheme 'internal' (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: 37af9234-ae03-4bc7-a8a5-3a3bc5e08eba) (SDK Attempt Count: 1)" (RequestToken: 7e147881-8745-a761-4deb-0dea575f6352, HandlerErrorCode: InvalidRequest)
if (props.enablePrefixForIpv6SourceNat !== true && props.subnetMappings.some(sm => sm.sourceNatIpv6Prefix !== undefined)) { | ||
throw new ValidationError('Cannot specify `sourceNatIpv6Prefix` for a load balancer that does not have `enablePrefixForIpv6SourceNat` enabled.', this); | ||
} |
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.
This setting causes deployment failure.
Resource handler returned message: "'EnablePrefixForIpv6SourceNat' must be set to 'on', before 'SourceNatIpv6Prefix' can be specified. (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: 68ca21fc-6c22-4375-86f5-4fa27b0a7e7b) (SDK Attempt Count: 1)" (RequestToken: f07c93ee-f6ea-d3ad-e24b-9724d5611526, HandlerErrorCode: InvalidRequest)
/** | ||
* Specifies a subnet for a load balancer | ||
*/ | ||
export interface SubnetMapping { |
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.
Currently, subnetMapping
exists only as a configuration item for NLB, but I defined it in base-loadbalancer.ts
in anticipation that items for ALB may be added in the future.
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.
Overall this lgtm, just left a few minor comments.
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts
Outdated
Show resolved
Hide resolved
internetConnectivityEstablished = baseProps.vpc.selectSubnets( | ||
{ subnetFilters: [ec2.SubnetFilter.byIds(mappedSubnetIds)] }, | ||
).internetConnectivityEstablished; |
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.
nit: could we rename this variable so it has a different name from the actual property that we're checking when filtering. It feels a bit confusing if they're named the same.
internetConnectivityEstablished = baseProps.vpc.selectSubnets( | |
{ subnetFilters: [ec2.SubnetFilter.byIds(mappedSubnetIds)] }, | |
).internetConnectivityEstablished; | |
internetConnectivityEstablishedSubnets = baseProps.vpc.selectSubnets( | |
{ subnetFilters: [ec2.SubnetFilter.byIds(mappedSubnetIds)] }, | |
).internetConnectivityEstablished; |
…e-load-balancer.ts Co-authored-by: paulhcsun <[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.
Great stuff! Thank you for your contribution on this highly requested feature!
@Mergifyio update |
☑️ Nothing to do
|
packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
Outdated
Show resolved
Hide resolved
…k-load-balancer.ts
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #9696.
Reason for this change
Cloudformation supports the configuration of subnet information through
subnetMapping
more detailed than usingsubnetIds
but AWS CDK doesn't support this.https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-subnetmapping.html
Description of changes
subnetMappings
toNetworkLoadBalancerProps
SourceNatIpv6Prefix
class andSubnetMapping
interface atbase-loadbalancer.ts
Describe any new or updated permissions being added
None
Description of how you validated changes
Add both unit and integ tests
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license