big-pizza-47421
10/23/2021, 5:26 PM// Allocate a new VPC that uses all of the current region's availability zones:
const vpc = new awsx.ec2.Vpc(`lsports-${getStack()}`, {
numberOfAvailabilityZones: "all",
subnets: [
{ type: "public" },
{ type: "private" },
{ type: "isolated", name: "db" },
{ type: "isolated", name: "redis" },
],
tags: baseTags,
});
and the following ECS project
const vpc = awsx.ec2.Vpc.fromExistingIds(`lsports-${getStack()}`, {
vpcId: network.getOutput("vpcId"),
});
// Create a load balancer on port 80 and spin up two instances of Nginx.
const alb = new awsx.elasticloadbalancingv2.ApplicationLoadBalancer(
"web-traffic",
{
vpc: vpc,
subnets: network.getOutput("publicSubnetIds"),
tags: baseTags,
}
);
const listener = alb.createListener("web-listener", { port: 80 });
const nginx = new awsx.ecs.FargateService("nginx", {
tags: baseTags,
taskDefinitionArgs: {
containers: {
nginx: {
image: "nginx",
memory: 128,
portMappings: [listener],
},
},
},
desiredCount: 2,
});
I'm getting the following error:
* error creating application Load Balancer: ValidationError: At least two subnets in two different Availability Zones must be specified
status code: 400, request id: 99ff6eef-e935-43e3-b34a-cf36251db0e7
which is weird, since I have public subnets across all AZ's, if I create the VPC in the same project everything seem to work as expected