ECS Task Placement Strategies

  • A task placement strategy is an algorithm for selecting instances for task placement or tasks for termination. When a task that uses the EC2 launch type is launched, Amazon ECS must determine where to place the task based on the requirements specified in the task definition, such as CPU and memory. Similarly, when you scale down the task count, Amazon ECS must determine which tasks to terminate. 
  • A task placement constraint is a rule that is considered during task placement.
    • You can use constraints to place tasks based on Availability Zone or instance type. 
    • You can also associate attributes, which are name/value pairs, with your container instances and then use a constraint to place tasks based on attribute.
  • Task placement strategy types:
    • Binpack – Place tasks based on the least available amount of CPU or memory. This minimizes the number of instances in use and allow you to be cost-efficient. For example, you have running tasks in c5.2xlarge instances that are known to be CPU intensive but are not memory consuming. You can maximize your instances’ memory allocation by launching tasks in them instead of spawning a new instance.

ECS Task Placement Strategies

    • Random – Place tasks randomly. You use this strategy when task placement or termination does not matter.

ECS Task Placement Strategies

    • Spread – Place tasks evenly based on the specified value. Accepted values are attribute key-value pairs, instanceId, or host. Spread is typically used to achieve high availability by making sure that multiple copies of a task are scheduled across multiple instances. Spread across Availability Zones is the default placement strategy used for services.

ECS Task Placement Strategies

IT Certification Category (English)728x90
  • You can combine different strategy types to suit your application needs.
  • Task placement strategies are a best effort.
  • By default, Fargate tasks are spread across Availability Zones.
  • By default, ECS uses the following placement strategies:
    • When you run tasks with the RunTask API action, tasks are placed randomly in a cluster.
    • When you launch and terminate tasks with the CreateService API action, the service scheduler spreads the tasks across the Availability Zones (and the instances within the zones) in a cluster.



AWS Certifications are consistently among the top paying IT certifications in the world, considering that Amazon Web Services is the leading cloud services platform with almost 50% market share! Earn over $150,000 per year with an AWS certification!

Subscribe to our newsletter and notifications for more helpful AWS cheat sheets and study guides like this and answer as many AWS practice exams as you can.🙂

Pass your AWS Certifications on your First Try with the Tutorials Dojo Portal

Tutorials Dojo portal

Our Bestselling AWS Certified Solutions Architect Associate Practice Exams

AWS Certified Solutions Architect Associate Practice Exams

Enroll Now – Our AWS Practice Exams with 95% Passing Rate

AWS Practice Exams Tutorials Dojo

Tutorials Dojo Study Guide and Cheat Sheets eBooks

Tutorials Dojo Study Guide and Cheat Sheets-2

FREE AWS eBook for Beginners

AWS eBook Tutorials Dojo

FREE AWS Practice Test Samplers

Browse Other Courses

Generic Category (English)300x250

Recent Posts