Skip to content

Create metrics and alarms for ECS tasks that stop for reasons other than scaling activities. (i.e., crashes.)

License

Notifications You must be signed in to change notification settings

wheatstalk/cdk-crashy-task-metrics

Repository files navigation

CDK Crashy Task Metrics

Use this CDK construct to detect and alarm when ECS tasks crash more than they should.

Example

// Create CrashyTaskMetrics for an ECS service
const crashyTaskMetrics = new CrashyTaskMetrics(this, 'CrashyTaskMetrics', {
  service,
});

// Create alarm for more than two crashes in five minutes.
const crashAlarm = crashyTaskMetrics
  .metricTaskCrashes({ period: cdk.Duration.minutes(5) })
  .createAlarm(this, 'CrashAlarm', {
    comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD,
    evaluationPeriods: 1,
    threshold: 2,
  });

About

Create metrics and alarms for ECS tasks that stop for reasons other than scaling activities. (i.e., crashes.)

Resources

License

Stars

Watchers

Forks

Packages

No packages published