- Mais recentes
- Mais votos
- Mais comentários
Hey Cy, the issue is not with the Task Placement but with the Task Constraint. You want the ECS to spread the tasks on different instances so that if an EC2 dies you have spread the tasks to other EC2s etc.. You need to setup a Constraint https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html
You will need to setup distinctInstance
- Place each task on a different container instance. This task placement constraint can be specified when either running a task or creating a new service.
"placementConstraints": [
{
"type": "distinctInstance"
}
]
In the aws_ecs_service resource in TF, you will need
placement_constraints {
type = "distinctInstance"
}
placement_constraints- (Optional) Rules that are taken into consideration during task placement. Updates to this configuration will take effect next task deployment unless force_new_deployment is enabled
Task placement strategies are a best effort. Amazon ECS still attempts to place tasks even when the most optimal placement option is unavailable. However, task placement constraints are binding, and they can prevent task placement.
Thanks, Gary! It worked for me.
Is there a base version that corresponds to the behavior of this content? I only included ordered_placement_strategy in a new test cluster but it behaved the same as when distinctInstance was not included.
Conteúdo relevante
- AWS OFICIALAtualizada há 7 meses
- AWS OFICIALAtualizada há 2 anos
How many tasks in service b? How many configured containers for service b?
Thanks for the reply. There are only 2 tasks in service b. And only one container for one service each.
Thanks Cy.. I see the issue..