We've seen how we can deploy long-running applications as ECS services, but how do we run ad-hoc tasks or short-lived containers using ECS? The answer of course is to create an ECS task, which typically are used to run ad-hoc tasks, such as running a deployment script, performing database migrations, or perhaps performing scheduled batch processing.
Although ECS services are essentially long-running ECS tasks, ECS does treat ECS tasks that you create yourself quite differently from ECS services, as described in the following table:
Scenario/feature | ECS service behavior | ECS task behavior |
Container is stopped or fails | ECS will always attempt to maintain the desired count of a given ECS service, and will attempt to restart ... |