Aws.ecsRunTask()

Start a task using random placement and the default Amazon ECS scheduler.

Usage

Hover over inputs/exits for more info.

var Aws = require('machinepack-aws');


// Start a task using random placement and the default Amazon ECS scheduler.

Aws.ecsRunTask({

accessKeyId: 'akid',

secretAccessKey: 'secret',

taskDefinition: 'arn:aws:ecs:us-west-2:577431834720:task-definition/taskName:1',

region: 'us-west-2',

apiVersion: '2014-11-13',

cluster: 'myCluster',

count: 1,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

accessKeyId required

AWS IAM user access key id.

'akid'
secretAccessKey required

AWS IAM user secret access key

'secret'
taskDefinition required

A registered task definition on ECS that will be used to start a task.

'arn:aws:ecs:us-west-2:577431834720:task-definition/taskName:1'
region

Which region to use. Defaults to us-west-2

'us-west-2'
apiVersion

Which api version to use. Defaults to: latest

'2014-11-13'
cluster

Which cluster to run the task on. Defaults to `default`

'myCluster'
count

How many containers to run. Defaults to 1.

1

Exits

error

An unexpected error occurred.

success

OK.

{ failures: [],
  tasks: 
   [ { clusterArn: 'arn:aws:ecs:us-west-2:575431834730:cluster/default',
       containerInstanceArn: 'arn:aws:ecs:us-west-2:575431834730:container-instance/98950f3c-7347-4249-99cb-168832a1b8f2',
       containers: 
        [ { containerArn: 'arn:aws:ecs:us-west-2:575431834730:container/23cb1b84-0d02-4a85-a672-7a2b1c0410d7',
            lastStatus: 'PENDING',
            name: 'preview',
            taskArn: 'arn:aws:ecs:us-west-2:575431834730:task/55b9b3b1-f189-4e5e-9e3a-83832c69b57e' } ],
       desiredStatus: 'RUNNING',
       lastStatus: 'PENDING',
       overrides: { containerOverrides: [ { name: 'container' } ] },
       taskArn: 'arn:aws:ecs:us-west-2:575431834730:task/55b9b3b1-f189-4e5e-9e3a-83832c69b57e',
       taskDefinitionArn: 'arn:aws:ecs:us-west-2:575431834730:task-definition/containerName:1' } ] }