Question: I’ve got a simple vpc with a rds db and ...
# general
Question: I’ve got a simple vpc with a rds db and a fargate service as long as an ALB. My objective is to create a listener that automatically redirect traffic from 80 to 443. Api docs are still not good since they refer to alb.createListener that isn’t present in the library. I’ve gotten to this point but failing to understand what targetGroup I should set in my default action for forwarding. I’ve removed other details like vpc creation etc… since they weren’t relevant to my problem.
const cluster = new aws.ecs.Cluster(envRelated('st-primary-ecs-cluster'));
const alb = new <|>.ApplicationLoadBalancer(
envRelated("stp-loadbalancer"), {subnetIds: vpc.publicSubnetIds,listeners: [{
port: 443,
protocol: "HTTPS",
certificateArn: certificateArn,
defaultActions: [{ type: "forward", targetGroupArn: ??? },],
} ,
port: 80,
protocol: "HTTP",
defaultActions: [
type: "redirect",
redirect: {
port: "443",
protocol: "HTTPS",
statusCode: "HTTP_301",
const repo = new awsx.ecr.Repository(envRelated("ecr-st-repo"), {
forceDelete: true,
const imgApi = new awsx.ecr.Image(envRelated('st-api'), { repositoryUrl: repo.url, path: "./api", target: 'production' });
const appServiceApi = new awsx.ecs.FargateService("st-api-svc", {
cluster: cluster.arn,
assignPublicIp: true,
taskDefinitionArgs: {
container: {
image: imgApi.imageUri,
cpu: 102 /*10% of 1024*/,
memory: 50 /*MB*/,
essential: true,
portMappings: [ {containerPort: containerPort , targetGroup: alb.defaultTargetGroup} ],
desiredCount: 1,
I don't see why it wouldn't work. Where do you see the reference to
? That doesn't look very declarative. Your code kind of matches what I use, but I'm not using crosswalk.
if you check the https listener you'll see that I left some question mark because i cannot understand what target group should i set there
I think with crosswalk you have to create the target group at the same time, instead of specifying the target group ARN. See Sorry, I've never used crosswalk and it might have some pitfalls that I'm not aware of. Having said that, nothing prevents you from mixing providers together, like awsx and aws. Then you could create the target group using aws and pass it to awsx.
thx will try. can you share a working infra implementation for this use case that you use successfully ? just to have a good ref to build around
other than that, here the doc states using createListener/createTargetGroup methods that are not anymore included in crosswalk library
Please note that to use those methods you need an ALB first, it seems
They're methods of the load balancer, not the crosswalk library itself
Copy code
const alb = new"web-traffic");
const listener = alb.createListener("web-listener", { port: 80 });
Having said that, I can't find a reference to them in the docs. I'm sorry I'm not a crosswalk nor javascript Pulumi user, my knowledge isn't great with them...