ecsjobs

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Tests status

A scheduled job wrapper for ECS, focused on email reporting and adding docker exec and local command abilities.

This is a very, very esoteric project with a really niche use case.

I’ve migrated my very small personal AWS infrastructure to a single t2.micro ECS instance. I’m also trying to migrate some of my personal stuff from my desktop computer to that instance. I need a way to run scheduled tasks and report on their success or failure, and maybe some output (I have a cron wrapper script that does this on my desktop). But my AWS spend is about $15/month and I don’t want to go over that just because of a bunch of CloudWatch alarms. Also, sometimes the scheduled things I want to run are really docker exec into existing task containers.

This is a Python project (distributed as an ECS-ready Docker image) that aims to handle running scheduled things and then sending an email report on their success or failure. The main shortcomings this intends to address are the lack of simple built-in failure monitoring for Scheduled ECS Tasks, the lack of a built-in way to execute a command in a running (ECS Service) container, and the lack of useful email reports.

The generated email reports look like (this one for exampleconfig.yml):

screenshot of generated HTML email report

Upgrading to 2.0

  • The package requires Python 3.8 or newer and is tested on Python 3.8 through 3.14. The Docker image is built on Python 3.14 (see below).

  • The Docker image is now published only to the GitHub Container Registry as ghcr.io/jantman/ecsjobs (tags <version> and latest); the jantman/ecsjobs image on Docker Hub is no longer updated. The image is built on current Alpine and Python 3.14 (previously 3.9), which matters for any Python scripts your jobs run inside it.

  • The AWS CLI in the Docker image is now version 2 (Alpine’s aws-cli package) instead of version 1. Check job scripts for commands that changed between the two, such as the removed aws ecr get-login and the new default output pager and binary format.

  • The Docker image’s git_commit, git_url, build_time and maintainer labels are replaced by standard org.opencontainers.image.* labels.

  • The command array of LocalCommand, DockerExec and EcsDockerExec jobs is now validated so that every element must be a string; previously only the first element was checked.

  • Configuration YAML is loaded with yaml.safe_load.

  • Unknown keys in the global section or in a job now fail validation; previously they were silently ignored. Check your configuration (for example, for misspelled option names) before upgrading.

  • A failure_command with arguments now works; previously any command with arguments raised an error.

Contents

Release Notes

Release notes for each version are published as GitHub releases.

Indices and tables