Currently I have a ECS cluster running a service that is running a single task per container instance, each task takes nearly all the container instanceĀ“s resources. I'm wondering if thereĀ“s some way, perhaps by setting up the Number of tasks, Minimum healthy percent, Maximum percent on the service as well as a capacity provider to have it where once a new task version is to be deployed a new container instance is spinned up and once that is ready the old container instance is removed.
So using 2 container instances during the deploy, the old one and the one being spun up for the new task definition and in the end removing the old container instance, just leaving the 1 container instance running once the deploy is complete.
Best Answer
If you use ECS cluster auto scaling, the cluster will automatically add new instances as needed to place tasks during a deployment. Or, you could use Fargate and not worry about EC2 instance scaling at all.