we have an application which runs for 15 mins * 3 times a day. We dont want container to be running always (24*7). Once applicaiton finish, container should stop. i dont think we can achieve this in AWS Fargate
Will you please recommend any such container services in AWS?
CodePudding user response:
First, AWS Farget doesn't exist. I suppose you meant Fargate.
What you want is completely achievable, a task will stop once it's finished, only a service will always stay up and running.
Another solution would be to use an AWS Lambda, as an AWS lambda can run up to 15 minutes. You can also specify a docker image to run your AWS lambda in.
CodePudding user response:
From your description, you need to setup an ECS Scheduled Task, which will start the Fargate container at certain times of day, the container will stop once the process exits, and it will not be restarted until the next scheduled time.
Alternatively, you can some other process outside of ECS, such as a Lambda function, call the ECS RunTask API to accomplish the same thing.
In the above scenario, you will only be billed for the time the Fargate task is running.
This contrasts with an ECS Service, which typically keeps one or more tasks running 24/7. Although you can setup ECS Service auto-scaling to scale down to 0 tasks, which is another option you might pursue.