stale-photographer-81807
06/24/2021, 2:04 AM<http://awsx.lb|awsx.lb>
.
I am trying to deploy an ECS/Fargate service with an AppLb accesible only in the private subnets. It works just fine with external: true
but if I change it to false
the provisioning fails with:
aws:lb:LoadBalancer (alb):
error: 1 error occurred:
* error creating application Load Balancer: ValidationError: At least two subnets in two different Availability Zones must be specified
status code: 400, request id: 4a7dd444-54b3-4952-8aa2-e26200f5fdef
I have tried injecting the subnet
to the LoadBalancer and the Listener explicitely with no success. Assumed external
handled that just fine with the default vpc.
Here is the code:
const cluster = new awsx.ecs.Cluster("cluster");
const alb = new awsx.lb.ApplicationLoadBalancer("alb", { external: false });
const web = alb.createListener("web", { port: 80 });
const img = awsx.ecs.Image.fromPath("node-web", "../app");
const appService = new awsx.ecs.FargateService("ecs-fargate", {
cluster,
taskDefinitionArgs: {
container: {
environment: [{"name": "foo", "value": "bar"}],
image: img,
cpu: 102 /*10% of 1024*/,
memory: 50 /*MB*/,
portMappings: [web],
},
},
desiredCount: 1,
});
great-sunset-355
06/24/2021, 6:35 AMdamp-school-17708
06/24/2021, 7:45 AM