Monitor an ECS Deployment
Last updated a year ago by coen-hyde .
MIT · Original npm · Tarball · package.json
$ cnpm install ecs-deployment-monitor 
SYNC missed versions from official npm registry.

ECS Deployment Monitor

ECS Deployment Monitor will help you monitor the status of a deployment of a new task definition to an ECS Service. It does not do the deployment its self.

Its primary use case it to identify when a deploy fails. When containers in a task fail to start, ECS will terminate the task and start a new one. This is a great feature until you have a version of your application that will not start. In this scenario ECS will continue to start and stop tasks indefinitely, while leaving you none the wiser that your deploy has failed and an old version of your application is still running.

This monitor uses the healthy status on Target Group Targets to determine if a task is healthy. Thus use of an Application Load Balancer or Network Load Balancer is assumed and this monitor will not work without one.


Install package with NPM.

npm install ecs-deployment-monitor --save

Remove --save and add the -g flag to install globally if you wish to use the CLI version.

Ensure you run the monitor with the following IAM permissions:


Possible Deployment States


A deployment matching the TaskDefinition was not found


A newer deployment has been created. This deployment is no longer being deployed.


Deployment has been created but no other activity has occurred.


New tasks have been started but they are not healthy yet.


The number of tasks which failed to start exceeded the defined failure threshold. Default 25%.


All new tasks have a healthy status as reported by targets on the Application Load Balancer. Tasks running with an old task definition revision are still running.


No new requests will go to old tasks. Old tasks are draining.


ECS Service has reached a steady state

CLI Usage

If this module is installed globally an executable ecs-deployment-monitor should be available


  • cluster (required) - The arn of the ECS Cluster that is hosting the service
  • service-name (required) - The name of the ECS Service
  • task-definition (required) - The arn of the ECS Task Definition that was deployed
  • failure-threshold (optional) - The percentage of failed tasks from desired tasks which is triggers a failed deploy. Defaults to 25%. Expects a float. eg .50 would represent a threshold of 50%
$ ecs-deployment-monitor \
    --cluster xxx \
    --service-name xxx \
    --task-definition xxx

Example output


Failed Deployments


Failed deployments will exit with a non-zero exit code. The following states are failed deploys:

  • TasksFailed will exit with an exit code of 1
  • NotFound will exit with an exit code of 2
  • Usurped will exit with an exit code of 3

Module Usage

const monitor = require('ecs-deployment-monitor');

let deployment = monitor({
  serviceName: 'name',
  clusterArn: 'arn::cluster',
  taskDefinitionArn: 'arn::task-definition',

deployment.on('error', (error) => console.log(error));
deployment.on('state', (state) => console.log(state));
deployment.on('end', (state) => console.log('DONE'));

Current Tags

  • 0.2.4                                ...           latest (a year ago)

12 Versions

  • 0.2.4                                ...           a year ago
  • 0.2.3                                ...           a year ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.6                                ...           3 years ago
  • 0.1.5                                ...           3 years ago
  • 0.1.4                                ...           3 years ago
  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (10)
Dev Dependencies (6)
Dependents (2)

Copyright 2014 - 2017 © |