AwsCLI icon
If icon
SlackIncomingWebhook icon
Schedule icon

AWS ECS Container Stopped Task Non-Zero Exit Code Sentinel

Audits Amazon ECS clusters to detect stopped container tasks with non-zero exit codes indicating application crashes.

Categories
CloudInfrastructure

How it works

This sentinel leverages AwsCLI to list and describe recently stopped ECS tasks across target clusters. It inspects container exit codes and stop reasons, triggering immediate alerts when containers terminate with non-zero codes (such as exit code 137 for OOM kills or exit code 1 for runtime crashes).

What you get

  • Real-time visibility into silent container crashlooping across ECS services.
  • Immediate detection of memory allocation breaches and unhandled exceptions.
  • Automated Slack delivery detailing task IDs, container names, exit codes, and stop reasons.

Who it's for

  • Container platform engineers and DevOps teams running ECS on Fargate or EC2.
  • SREs supervising containerized production service availability.

Why orchestrate this with Kestra

Kestra runs automated scheduled operational health checks with native error handling, secret injection, and multi-channel alerting.

Prerequisites

  • AWS IAM credentials with ecs:ListTasks and ecs:DescribeTasks permissions.
  • Secrets AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and SLACK_WEBHOOK configured in Kestra.

Quick start

  1. Import this blueprint into Kestra.
  2. Configure cluster_name, aws_region, and credentials.
  3. Run manually to check current stopped task statuses.

How to extend

  • Query CloudWatch Logs automatically for the failed task container logs to include stack traces.
  • Correlate stopped tasks with AWS Auto Scaling events.
  • Forward ECS failure events to an incident response system like PagerDuty.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.