Run a task every hour - using containers


I am looking to use containers to run a task every hour using containers. Imagine the task takes 20 minutes, so it's not suitable for lambda, and it's not suitable for EC2, since 40 minutes out of every hour the instance would be idle.

I have created a container that runs one simple task, (writes a row into a database) then stops. I created a docker container, pushed this to ECR, then created an ECS task that appears to run the task constantly (starting / restarting). I set the number of tasks to 0 for the cluster to stop this behaviour.

I then created a schedule using AWS event bridge, and set it to run the task every hour, but it's not running at all.

Can anyone suggest something that I should look at to achieve the desired scheduled task?

1 Answer

I found the solution myself : I was using a ECS service, rather than an ECS scheduled task, which then solved the problem.

Here's the full answer:

profile picture
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions