Closed tkumark closed 4 years ago
The taskDefinition section will accept a placementStrategy
, with the same fields and types as the service, but not schedulingStrategy
. I think you might be looking for placementConstraints
in taskDefinition, which is an array of objects with type
(memberOf
or distinctInstance
) and expression
.
@a-murphy if were to set placementConstraints at the service level would it be like this?
service:
placementStrategy:
- field: attribute:appname == myapp
type: memberof
service:
placementConstraints:
- field: "attribute:appname == myapp"
type: memberOf
should be valid assuming you have an appname
attribute on the instances. It is still placementConstraints
whether it is in the task definition or service with those settings. The placementStrategy can only be binpack
, random
, or spread
.
@a-murphy thanks you right the appname
attribute is set in the instances. I am adding at userdata
echo ECS_INSTANCE_ATTRIBUTES={\"appname\":\"myapp\"} >> /etc/ecs/ecs.config;echo
Set placement constrainst for custome attribute.
- name: myresourceName
type: dockerOptions
version:
service:
placementConstraints:
- expression: "attribute:appname == myapp"
type: memberOf
ECS offers 2 places where placement constraints are available on is the task definition level and service definition
Task Definition level
Service Definition level
In the documention Docker Option I only saw schedulinStrategy under service but nothing under nothing under taskDefinition.
Should I put my placement constraints under schedulingStragtegy? Is there something for taskdefintion