12

I need my personal project run one-off tasks on ECS with Fargate, like migration, app command etc.

The build and deploy pipelines are on Gitlab without job runners.

Are there are any possibilities to run a container and die after the command execution on ECS Fargate?

1 Answer 1

17

Yes.

Fargate tasks can either run "standalone" or as part of an ECS service. The former are typically used for one-off / batch jobs, the latter are being used for long running apps (the ECS service will make sure a certain amount of tasks will always be running). See here for additional background. This isn't to say that the "standalone" mode can't execute long-running apps but simply there is no feedback loop with those and if they fail they will just stop.

For your use case you want to run one of these "standalone" tasks with a docker command that executes and exits. This will stop the task when the commands finishes. I am not how you intend to run this task but this is the CLI method to run this "one-off" task instance. The equivalent exists for the various language bindings of the AWS SDKs.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.