Hey everyone, moving from AWS CDK to Pulumi and I'...
# typescript
Hey everyone, moving from AWS CDK to Pulumi and I've been having trouble trying to replicate the ApplicationLoadBalancedFargateService construct from the CDK. The biggest problem is the ports. I'd prefer to do this the "correct" way using awsx, but all of the examples from the docs rely on the container port being 80. How can I specify a different port?
Copy code
const 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,
Is it normal/acceptable to change the ApplicationListener port?
You could try creating a target group from that application listener and give the TG the port you want it to use with the targets in the group. Then pass the TG resource as the value for your container task def's
property. awsx allows you to create a TG from the listener by using the
method available on the listener resource. By the way, as a side note your application listener variable is a bit misleading.
made me think you were creating a load balancer resource. It would be good to call it
Sounds good, I think I may have figured it out. Appreciate the help. Also, the snippet was from the docs. I agree. https://www.pulumi.com/docs/guides/crosswalk/aws/ecs/#creating-a-load-balanced-ecs-service
Great! What was it?
Thought I'd fixed it, but no luck! Still investigating
Tried with a custom target group, but no dice. Everything seems fine, but the target group times out on the health checks.
I assume you have a healthcheck endpoint in your app that the TG can ping?
I do. As is normally the case, the issue turned out to be a networking problem. Security groups weren't configured correctly.
Appreciate the help! As for the configuration, I ended up using:
Copy code
loadBalancers: [{ targetGroupArn: targetGroup.targetGroup.arn, containerName, containerPort }],
in the Fargate service definition
🎉 1
woohoo 1