-
Notifications
You must be signed in to change notification settings - Fork 4k
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): default config for internal load balancer will fall back to Isolated subnets #5696
feat(elbv2): default config for internal load balancer will fall back to Isolated subnets #5696
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
const vpcSubnets = ifUndefined(baseProps.vpcSubnets, | ||
{ subnetType: internetFacing ? ec2.SubnetType.PUBLIC : ec2.SubnetType.PRIVATE }); | ||
{ subnetType: vpcSubnetType }); |
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 recently updated Vpc
to have some of this behavior already (private => isolated as a fallback).
Can you try the following and see if that behaves the same?
const vpcSubnets = ... (internetFacing ? { subnetType: PUBLIC } : {});
I.e. leave subnetType
empty, rely on the Vpc
default to try private => isolated => public in that order?
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.
That just worked, no additional changes to tests needed.
packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts
Outdated
Show resolved
Hide resolved
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…/flemjame-at-amazon/aws-cdk into lb-isolated-subnet-default-support
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts
Outdated
Show resolved
Hide resolved
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Added a secondary default subnet selection for Load Balancers such that, if I have an isolated VPC like so:
I don't have to specify the subnets for an internal load balancer. Currently, users must specify their Isolated subnets like so:
With this change, if there are no Private subnets and internetFacing is
false
, then Isolated subnets will be selected, allowing users to code their NLB like so:This doesn't break the default behavior, which places a LB into Private subnets in the event that both Private and Isolated subnets exist. Users who are already specifying Isolated subnets can continue to do so, as I did not change the logic if the user specifies vpcSubnets.
Commit Message
feat(elbv2): default config for internal load balancer will fall back to Isolated subnets
Internal load balancers used to be always created in Private subnets, and hence fail if the VPC does not include Private subnets.
Now using the default VPC "private subnets" fallback mechanism which fixes this case.