Aws.ecsStopTask()

Stop a running ECS task.

Usage

Hover over inputs/exits for more info.

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


// Stop a running ECS task.

Aws.ecsStopTask({

accessKeyId: 'akid',

secretAccessKey: 'secret',

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

region: 'us-west-2',

apiVersion: '2014-11-13',

cluster: 'default',

}).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'
task required

The task UUIDs or full Amazon Resource Name (ARN) entry of the task you would like to stop.

'arn:aws:ecs:us-west-2:575231334330: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

The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task you want to stop. Defaults to `default`

'default'

Exits

error

An unexpected error occurred.

success

OK.

{ task: 
   { 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: 'RUNNING',
          name: 'preview',
          networkBindings: [ { bindIP: '0.0.0.0', containerPort: 1337, hostPort: 49156 } ],
          taskArn: 'arn:aws:ecs:us-west-2:575431834730:task/55b9b3b1-f189-4e5e-9e3a-83832c69b57e' } ],
     desiredStatus: 'STOPPED',
     lastStatus: 'RUNNING',
     overrides: { containerOverrides: [ { name: 'preview' } ] },
     taskArn: 'arn:aws:ecs:us-west-2:575431834730:task/55b9b3b1-f189-4e5e-9e3a-83832c69b57e',
     taskDefinitionArn: 'arn:aws:ecs:us-west-2:575431834730:task-definition/particlebanana-2Factor:1' } }