@bugcrowd/ecs-deployment-monitor

中文文档
0.3.6发布于 2025/11/25MITCommonJS近 30 天下载 4226

Monitor an ECS Deployment

原始使用文档
文档目录15 节
  1. Installation
  2. Possible Deployment States
  3. NotFound
  4. Usurped
  5. Created
  6. TasksStarted
  7. TasksFailed
  8. Live
  9. Draining
  10. Steady
  11. CLI Usage
  12. Options
  13. Example output
  14. Failed Deployments
  15. Module Usage

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.

Installation

Install package with NPM. NOTE: We have moved the package under our bugcrowd NPM organization - this will be the only package location maintained going forward.

npm install @bugcrowd/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:

ecs:DescribeContainerInstances
ecs:DescribeServices
ecs:DescribeTasks
ecs:ListContainerInstances
ecs:ListTasks
elasticloadbalancing:DescribeTargetHealth

Possible Deployment States

NotFound

A deployment matching the TaskDefinition was not found

Usurped

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

Created

Deployment has been created but no other activity has occurred.

TasksStarted

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

TasksFailed

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

Live

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.

Draining

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

Steady

ECS Service has reached a steady state

CLI Usage

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

Options

  • 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

standard-requests

Failed Deployments

standard-requests

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'));

版本与发布记录

@bugcrowd/ecs-deployment-monitor 共发布 24 个版本,首次发布于 2021/08/25;过去 12 个月发布了 1 个版本。

版本发布日期距今
0.3.6latest2025/11/2511 个月前
0.3.52024/11/291.9 年前
0.3.42024/08/122 年前
0.3.32024/07/312 年前
0.3.12024/05/022 年前
0.3.22024/05/022 年前

关于 @bugcrowd/ecs-deployment-monitor 的常见问题

@bugcrowd/ecs-deployment-monitor 是什么?

Monitor an ECS Deployment

如何安装 @bugcrowd/ecs-deployment-monitor?

在项目目录运行 npm install @bugcrowd/ecs-deployment-monitor,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ecs-deployment-monitor,可以用 npx ecs-deployment-monitor 直接运行。

@bugcrowd/ecs-deployment-monitor 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bugcrowd__ecs-deployment-monitor 是否存在。

@bugcrowd/ecs-deployment-monitor 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bugcrowd/ecs-deployment-monitor 可以商用吗?

@bugcrowd/ecs-deployment-monitor 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bugcrowd/ecs-deployment-monitor 的下载量有多少?

根据 npm 官方下载统计,@bugcrowd/ecs-deployment-monitor 在 2026/10/09 – 2026/11/07 这 30 天内被下载 4,226 次,日均约 141 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bugcrowd/ecs-deployment-monitor 还在维护吗?

最新版本 0.3.6 发布于 2025/11/25(11 个月前);至今共发布 24 个版本,其中过去 12 个月发布了 1 个;首次发布于 2021/08/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。