Starting tasks that were on a draining ECS instance does not honour placement strategies
I've got the following placement strategies set on my service:
- AZ Spread
- Binpack CPU
For example assume the cluster looks like this:
Availability zone A:
- ECS Instance 1: has 5 tasks
- ECS Instance 2: has 3 tasks
Availability zone B:
- ECS Instance 3: has 5 tasks
Availability zone C:
- ECS Instance 4: has 5 tasks
When scaling down lets assume ECS Instance 2 is removed from the cluster, I set the instance to "DRAINING" before terminating it. I expect the 3 tasks on it to be spread across the AZs but what I end up with is this:
Availability zone A:
- ECS Instance 1: has 8 tasks
Availability zone B:
- ECS Instance 3: has 5 tasks
Availability zone C:
- ECS Instance 4: has 5 tasks
Image a larger number of tasks per instance and you can see how the cluster will get very imbalanced. Is there a way to sort this out ?
@FahadMustafa There may be other constraints such as resources, attributes which can decide the placement of tasks. Could you please reach out via AWS forums or support to further debug this, since it is not directly related to agent? Closing this issue, please feel free to reopen if there are concerns. Thanks.