damp-byte-39631
02/03/2022, 2:02 AMconst lb = new awsx.lb.ApplicationListener("nginx", { port: 80 });
const nginx = new awsx.ecs.FargateService("nginx", {
taskDefinitionArgs: {
containers: {
nginx: {
image: "nginx",
memory: 128,
portMappings: [ lb ], // I'd like to specify a different
// container port here
},
},
},
desiredCount: 2,
});
clever-sunset-76585
02/03/2022, 4:58 AMportMappings
property. awsx allows you to create a TG from the listener by using the createTargetGroup()
method available on the listener resource.
By the way, as a side note your application listener variable is a bit misleading. lb
made me think you were creating a load balancer resource. It would be good to call it listener
damp-byte-39631
02/03/2022, 5:32 AMclever-sunset-76585
02/03/2022, 6:21 AMdamp-byte-39631
02/03/2022, 1:54 PMclever-sunset-76585
02/03/2022, 3:17 PMdamp-byte-39631
02/03/2022, 3:27 PMloadBalancers: [{ targetGroupArn: targetGroup.targetGroup.arn, containerName, containerPort }],
in the Fargate service definition