Skip to content

Commit

Permalink
fix(elasticloadbalancingv2): default to one subnet per AZ
Browse files Browse the repository at this point in the history
Both ALBs and NLBs require that the subnets chosen from the VPC are all
in separate AZs - however, the default SubnetSelection does not enforce
that requirement.
  • Loading branch information
scubbo committed Jun 8, 2023
1 parent d754c37 commit 2153e7d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export abstract class BaseLoadBalancer extends Resource {
const internetFacing = ifUndefined(baseProps.internetFacing, false);

const vpcSubnets = ifUndefined(baseProps.vpcSubnets,
(internetFacing ? { subnetType: ec2.SubnetType.PUBLIC } : {}) );
(internetFacing ? { subnetType: ec2.SubnetType.PUBLIC, onePerAz: true } : { onePerAz: true }) );
const { subnetIds, internetConnectivityEstablished } = baseProps.vpc.selectSubnets(vpcSubnets);

this.vpc = baseProps.vpc;
Expand Down

0 comments on commit 2153e7d

Please sign in to comment.