Task groups - Amazon Elastic Container Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Task groups

You can identify a set of related tasks as a task group. All tasks with the same task group name are considered as a set when using the spread task placement strategy. For example, suppose that you're running different applications in one cluster, such as databases and web servers. To ensure that your databases are balanced across Availability Zones, add them to a task group named databases and then use the spread task placement strategy. For more information, see Amazon ECS task placement strategies.

Task groups can also be used as a task placement constraint. When you specify a task group in the memberOf constraint, tasks are only sent to container instances that run tasks in the specified task group. For an example, see Example constraints.

By default, standalone tasks use the task definition family name (for example, family:my-task-definition) as the task group name if a custom task group name isn't specified. Tasks launched as part of a service use the service name as the task group name and can't be changed.

The following requirements for the task group name must be considered.

  • A task group name must be 255 or fewer characters.

  • Each task can be in exactly one group.

  • After launching a task, you can't modify its task group.