ecs-fargate-task-termination-detection-event-rule
v0.1.1
Published
An AWS CDK construct that creates an Amazon EventBridge rule to detect ECS/Fargate task terminations with non-zero container exit codes, while excluding expected scaling events.
Maintainers
Readme
ECS Fargate task termination detection event rule (AWS CDK V2)
An AWS CDK construct that creates an Amazon EventBridge rule to detect ECS/Fargate task terminations with non-zero container exit codes, while excluding expected scaling events.
Features
- Detects ECS task state changes where
lastStatusisSTOPPED - Filters for non-zero container exit codes
- Excludes common, expected scaling stop reasons
Installation
TypeScript
npm
npm install ecs-fargate-task-termination-detection-event-ruleyarn
yarn add ecs-fargate-task-termination-detection-event-ruleUsage
import { EcsFargateTaskTerminationDetectionEventRule } from 'ecs-fargate-task-termination-detection-event-rule';
const clusterArn = 'arn:aws:ecs:us-east-1:123456789012:cluster/example-app-cluster';
const rule = new EcsFargateTaskTerminationDetectionEventRule(stack, 'EcsFargateTaskTerminationDetectionEventRule', {
description: 'example event rule.',
clusterArn,
});
Options
clusterArn(required): ARN of the ECS cluster to monitor- Any other
RulePropsoptions (e.g.,description,enabled,ruleName,targets) can be provided as usual. eventPattern: Not supported. This construct always defines its owneventPatternand will throw if you provide one.
Requirements
- Node.js
>= 20 - AWS CDK
aws-cdk-libv2 constructsv10
License
This project is licensed under the (Apache-2.0) License.
