Track Amazon ECS Availability Zone rebalancing - 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 (PDF).

Track Amazon ECS Availability Zone rebalancing

You can verify if Availability Zone rebalancing is enabled for a service in the console or by calling describe-services. The following example can be used to see the status with the CLI.

The response will be either ENABLED or DISABLED.

aws ecs describe-services \ --services service-name \ --cluster cluster-name \ --query services[0].availabilityZoneRebalancing

Service events

Amazon ECS sends service action events to help you understand the Availability Zone rebalancing lifecycle.

Event Scenario Type Learn more
SERVICE_REBALANCING_STARTED Amazon ECS starts an Availability Zone rebalancing operation INFO service (service-name) is not AZ balanced with number-tasks tasks in Availability Zone 1, number-tasks in Availability Zone 2, and number-tasks in Availability Zone 3. AZ Rebalancing in progress.
SERVICE_REBALANCING_COMPLETED The Availability Zone rebalancing operation completes INFO service (service-name) is AZ balanced with number-tasks tasks in Availability Zone 1, number-tasks tasks in Availability Zone 2, and number-tasks tasks in Availability Zone 3.
TASKS_STARTED Amazon ECS successfully start tasks as part of the Availability Zone rebalancing operation INFO service-name has started number-tasks tasks in Availability Zone to AZ Rebalance: task-ids.
TASKS_STOPPED Amazon ECS successfully stops tasks as part of the Availability Zone rebalancing operation INFO service-name has stopped number-tasks running tasks in Availability Zone due to AZ rebalancing: task-id.
SERVICE_TASK_PLACEMENT_FAILURE Amazon ECS failed to start a task as part of the Availability Zone rebalancing operation ERROR For the EC2 launch type, see service (service-name) is unable to place a task in Availability Zone because no container instance met all of its requirements.

For the Fargate launch type, see service (service-name) is unable to place a task in Availability Zone.

TASKSET_SCALE_IN_FAILURE_BY_TASK_PROTECTION The Availability Zone rebalancing operation is blocked because task protection is in use. INFO service (service-name) was unable to AZ Rebalance because task-set-name was unable to scale in due to reason.
SERVICE_REBALANCING_STOPPED The Availability Zone rebalancing operation stopped. Amazon ECS sends additional events which provide more information. INFO service (service-name) stopped AZ Rebalancing.

Task state change events

Amazon ECS sends a task state change event (START) for each task that is starts as part of the rebalancing process.

Amazon ECS sends a task state change event (STOPPED) event for each task that it stops as part of the rebalancing process. The reason is set to Availability Zone rebalancing initiated by (deployment ecs-svc/deployment-id).

For more information about the events, see Amazon ECS task state change events.