Monitor AWS ECS Scheduled Tasks with CronRabbit
AWSThe Problem
AWS ECS scheduled tasks can fail to launch (capacity issues), crash during execution, or exit with errors. CloudWatch only logs task state changes.
The Solution
Add the CronRabbit ping to your container's entrypoint or application code. If the container doesn't start or crashes, the missing ping triggers an alert.
Integration
Add the monitoring ping to your application code rather than the Docker entrypoint. This ensures the ping only fires if your actual logic completes.
Code Examples
ECS task entrypoint wrapper
Bash#!/bin/bash
curl -fsS -m 5 --retry 3 --retry-all-errors https://ping.cronrabbit.com/your-id/start
python3 /app/etl_pipeline.py
EXIT=$?
if [ $EXIT -eq 0 ]; then
curl -fsS -m 10 --retry 5 --retry-all-errors https://ping.cronrabbit.com/your-id
else
curl -fsS -m 10 --retry 5 --retry-all-errors https://ping.cronrabbit.com/your-id/fail
fi
exit $EXIT