https://pulumi.com logo
#general
Title
# general
a

agreeable-refrigerator-25320

06/05/2019, 3:32 PM
Hi Guys, I need to deploy a docker image that exposes multiple ports with aws Fargate, how can I manage it?
p

proud-alarm-92546

06/05/2019, 3:32 PM
are you using
awsx.ecs.FargateService
?
@agreeable-refrigerator-25320 or maybe better: What mechanism are you using now? 🙂
a

agreeable-refrigerator-25320

06/05/2019, 3:48 PM
yes, I am using
awsx.ecs.FargateService but I am not sure how to assign the port mappings
currently this is what i have
p

proud-alarm-92546

06/05/2019, 3:49 PM
in that case,
taskDefinitionArgs: { container: { portMappings: [ https ] }, },
is your friend. portMapping is a list.
a

agreeable-refrigerator-25320

06/05/2019, 3:50 PM
const appService = new awsx.ecs.FargateService("neo4j-svc", { cluster, taskDefinitionArgs: { container: { image: img, cpu: 200 /*CPU units*/, memory: 1024 /*MB*/, portMappings: [elb.createListener("neo4j-db-listener", { port: 7474, external: true, protocol: "HTTP", })], }, }, desiredCount: 1, });
this is my current code
but i am not sure how to skip the create listener part
p

proud-alarm-92546

06/05/2019, 3:51 PM
you can move the create listener out, stick it a ~var and consume it. or you can just stack another one in the
[ ]
block along with it.
a

agreeable-refrigerator-25320

06/05/2019, 3:52 PM
ok, i will give it a try, Thanks a lot
p

proud-alarm-92546

06/05/2019, 3:53 PM
at least, that's how I've read it. I haven't done it but it was on my todo list. (actually, that's not true: I DID pass two elb listeners successfully, but I never tested end to end..)
a

agreeable-refrigerator-25320

06/05/2019, 3:55 PM
did you create the listeners from the same elastic load balancer instance?
p

proud-alarm-92546

06/05/2019, 4:00 PM
yeah
(possibly the same target group associated with the alb, but same idea)
a

agreeable-refrigerator-25320

06/05/2019, 4:01 PM
ok i am triying to deploy it right now
it gives this error message
error: awsecs/serviceService resource 'neo4j-svc' has a problem: load_balancer: attribute supports 1 item maximum, config has 2 declared
w

white-balloon-205

06/05/2019, 4:52 PM
a

agreeable-refrigerator-25320

06/05/2019, 5:01 PM
oh ok, thanks a lot
so now, what are my options?