Run a task every hour - using containers

0

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?

profile picture
已提問 1 年前檢視次數 370 次
1 個回答
2

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: https://blog.dotnetframework.org/2022/11/29/running-a-scheduled-task-on-aws-a-workaround-for-the-15-minute-lambda-limit/

profile picture
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南