I've deployed a Micronaut application on AWS ECS Fargate container. Inside my application I have a couple of scheduled jobs that I have configured to run once a day. After deploying the application, the scheduled task does kick off. I've added logging to see if the job run, but there was nothing in the log. Is this a limitation within Fargate that prevents the tasks from running?
2 Answers
Fargate itself doesn't have any limitations. My guess is that your task became stopped and this why it isn't running. But according to your description you misuse Fargate containers.
You don't need to schedule jobs inside the container, use AWS EventBridge scheduled rule that will run your Fargate task. Refer to documentations for details: https://docs.aws.amazon.com/AmazonECS/latest/userguide/scheduled_tasks.html
Additional improvement of this approach could be using Step Functions to additionally orchestrate Fargate task, in this case you will be calling Step Function that contains Fargate task call. This approach can be useful if you want to have additional parameters setup, easier manual run etc.

- 306
- 1
- 4
There is nothing about Fargate that would prevent a scheduler inside a container from running. If your Fargate container is running 24/7 then something like a cron job that is scheduled to run inside that container should run just fine. It should be no different than if you ran the same container locally on your laptop and left it running all day to see if your schedules tasks kicked off.

- 183,023
- 24
- 297
- 295