Open laspsandoval opened 1 week ago
I think that I just need to do this:
ecs_service = ecs.Ec2Service( self, "MyService1", cluster=ecs_cluster, task_definition=task_definition, desired_count=1, placement_constraints=[ ecs.PlacementConstraint.distinct_instances(), ], placement_strategies=[ ecs.PlacementStrategy.spread_across(ecs.BuiltInAttributes.AVAILABILITY_ZONE) ], )
Tasks for this service will always be placed on a different EC2 instance from tasks of any other service using the same constraint.
This will require some testing, but should be pretty easy to implement.
The more specific the better.
No response
Summary
I think that I just need to do this:
ecs_service = ecs.Ec2Service( self, "MyService1", cluster=ecs_cluster, task_definition=task_definition, desired_count=1, placement_constraints=[ ecs.PlacementConstraint.distinct_instances(), ], placement_strategies=[ ecs.PlacementStrategy.spread_across(ecs.BuiltInAttributes.AVAILABILITY_ZONE) ], )
Tasks for this service will always be placed on a different EC2 instance from tasks of any other service using the same constraint.
This will require some testing, but should be pretty easy to implement.
Requirements
The more specific the better.
Related tickets
No response