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

hundreds-musician-51496

11/09/2018, 9:08 PM
Is there a built-in way to run a single task on an existing ECS cluster? I don't think the cloud-sdk
Task
class works for me as AFAICT it wants to create a cluster
w

white-balloon-205

11/09/2018, 9:12 PM
It is technically possible to use
cloud.Task
, but you need to set some configuration to indicate you want to use an existing Cluster instead of creating a new one.
cloud-aws:ecsClusterARN
is the main setting, but there are a couple others you may need to provide. See https://pulumi.io/quickstart/cloudfx/index.html. Alternatively, you can use
new aws.ecs.TaskDefinition
and then
runTask
from the Node.js
aws-sdk
at runtime to do this directly using AWS APIs.
h

hundreds-musician-51496

11/09/2018, 9:12 PM
Ok i'll look - thanks!
I looked at the implementation of
cloud.Task
and saw it was using the node SDK - how does it distinguish preview mode from non-preview?
Looks like I extend
ComponentResource
and implment an async
run
method? https://github.com/pulumi/pulumi-cloud/blob/master/aws/service.ts#L883