Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Example Amazon ECS task placement strategies

Focus mode
Example Amazon ECS task placement strategies - Amazon Elastic Container Service

You can specify task placement strategies with the following actions: CreateService, UpdateService, and RunTask.

Distribute tasks evenly across Availability Zones

The following strategy distributes tasks evenly across Availability Zones.

"placementStrategy": [ { "field": "attribute:ecs.availability-zone", "type": "spread" } ]

Distribute tasks evenly across all instances

The following strategy distributes tasks evenly across all instances.

"placementStrategy": [ { "field": "instanceId", "type": "spread" } ]

Bin pack tasks based on memory

The following strategy bin packs tasks based on memory.

"placementStrategy": [ { "field": "memory", "type": "binpack" } ]

Place tasks randomly

The following strategy places tasks randomly.

"placementStrategy": [ { "type": "random" } ]

Distribute tasks evenly across Availability Zones and then distributes tasks evenly across the instances within each Availability Zone

The following strategy distributes tasks evenly across Availability Zones and then distributes tasks evenly across the instances within each Availability Zone.

"placementStrategy": [ { "field": "attribute:ecs.availability-zone", "type": "spread" }, { "field": "instanceId", "type": "spread" } ]

Distribute tasks evenly across Availability Zones and then bin pack tasks based on memory within each Availability Zone

The following strategy distributes tasks evenly across Availability Zones and then bin packs tasks based on memory within each Availability Zone.

"placementStrategy": [ { "field": "attribute:ecs.availability-zone", "type": "spread" }, { "field": "memory", "type": "binpack" } ]

Distribute tasks evenly across instances and then bin pack tasks based on memory

The following strategy distributes tasks evenly across evenly across all instances and then bin packs tasks based on memory within each instance.

"placementStrategy": [ { "field": "instanceId", "type": "spread" }, { "field": "memory", "type": "binpack" } ]
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.