We have created a ECS cluster with Fargate and have created few tasks in service to be used in a CI/CD pipeline. Service has desired count of 1. So if we terminate any task, new task comes up automatically. Is there a way in which we can make sure that task completes and terminates? And when it does, service also should get terminated. We basically want to spin up one task for every stage of our pipeline and delete that task and service once the pipeline stage is completed. Is there any CLI commands that we can use for this case?
Asked
Active
Viewed 210 times
0
-
My understanding is services and tasks are more often used for long running processes. However, I have used one SaaS service that sets up a container that runs containers based on a trigger, so something like this is possible. The AWS ECS Batch processing architecture may provide some ideas or directions: https://github.com/aws-samples/ecs-refarch-batch-processing – Tim Feb 23 '21 at 07:45
-
Thanks for the help @Tim. But the tasks can as well be used for adhoc processing right? As in, we can spin up a single task, complete the container operations and the task will be autodeleted. Can the Service also be set up similarly? – Meghana B Srinath Feb 24 '21 at 15:47
-
I have only use ECS in the long running style so I can't help, other than saying that yes I think it's possible. Hopefully someone else can help you, if the link I gave you didn't help. I think that link shows how to spin up containers to do work then has them finish. – Tim Feb 24 '21 at 17:05