I am running one AWS ECS Service with two tasks (they are same) and one container per task. I would like to know, how to properly manage rolling updates?
As per information, I found inside AWS docs, a rolling update is the default option.
Task and services are described inside Terraform and I do update via aws cli:
aws ecs update-service --cluster $(ECS_CLUSTER) --service $(ECS_SERVICE) --force-new-deployment --task-definition $(ECS_TASK_DEFINITION)
Task configuration:
+-------------+---------+
| Task memory | 900 MiB |
+-------------+---------+
| Task CPU | 900 |
+-------------+---------+
Container configuration:
+-------------+---------+
| CPU | 256 |
+-------------+---------+
| Hard limit | 900 MiB |
+-------------+---------+
| Soft limit | 512 MiB |
+-------------+---------+
For this cluster I have registered one t3a.small instance, so available resources are following:
- CPU: 2048 units
- Memory: 1961 MiB
This is suitable for running two tasks, however I am facing issues during deployment:
Service web was unable to place a task because no container instance met all of its requirements. The closest matching container-instance 123123123 has insufficient CPU units available. For more information, see the Troubleshooting section.
Service deployment is configured like this:
- Minimum healthy percent 50
- Maximum percent 200
So my guess was, one service will be killed and the other one will be updated, however I am receiving this error instead.
How this should be configured correctly?
1 Answer 1
You may scale up the instance size to allow for a rolling deployment or kill the existing tasks to make place for the new container to run. Another solution is to change your deployment config so that the minimum healthy is 50% and Maximum percent 100%, this kill a task before starting a new one.