aws / containers-roadmap

This is the public roadmap for AWS container services (ECS, ECR, Fargate, and EKS).
https://aws.amazon.com/about-aws/whats-new/containers/
Other
5.21k stars 320 forks source link

[ECS] [request]: Support Placement Strategy "spread" on Task Group #1103

Open CpuID opened 4 years ago

CpuID commented 4 years ago

Community Note

Tell us about your request

Please support the ECS task placement strategy spread using a Task Group (defined in task placement constraints).

Which service(s) is this request for?

ECS

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?

I'm trying to deploy Zookeeper in ECS, which due to the need to have numerically indexed nodes (a la myid) I have opted to do 1 x ECS service per node, with desired count of 1 each, 3~ services total (initially) yielding 3 nodes total. Inspired by https://tech.smartling.com/self-healing-apache-zookeeper-cluster-470b248ccb12

I am then using the Task Family (or Service Name, same outcome) to extract the node number to inject accordingly.

I would like to ensure that the 3 x nodes do not end up on the same EC2 instance ID, by putting all 3 ECS services in the same Task Group, and then set them to spread on it.

According to the docs standalone tasks are spread based on the task group, but services are not, and if you try use it, you get an error of spread field 'group:zookeeper-1a' is invalid..

(these are AZ specific clusters intentionally btw, hence 1a in the naming)

Example configuration I would like to work with, defined on all 3 ECS services:

  "PlacementConstraints": [
    {   
      "Expression": "attribute:ecs.availability-zone =~ us-east-1a",
      "Type": "memberOf"
    },  
    {   
      "Expression": "task:group =~ zookeeper-1a",
      "Type": "memberOf"
    }   
  ],  
  "PlacementStrategy": [
    {   
      "Field": "group:zookeeper-1a",
      "Type": "spread"
    }   
  ]

Are you currently working around this issue?

Deploy without the constraint and hope that 2 nodes don't end up on the same host, and that the host goes down. And don't put it into production use :) Far from ideal...

Additional context

Nothing specific, thanks :)

Attachments

N/A

CpuID commented 4 years ago

I guess another workaround is using host port bindings, so that the host port can't be used by more than a single task on the same EC2 instance?