Posted On: Nov 15, 2023

Amazon Elastic Container Service (Amazon ECS) now supports idempotency for task launches, allowing you to safely retry task launches without side effects. This feature helps ensure that timeouts or connection errors do not result in the launch of more instances than you originally intended, saving you time and money.

Idempotent operations allow a request to be retried with no additional side effects. You can now ensure that at most the desired number of tasks are launched as part of a RunTask API request by adding the following input to the request —client-token abcd. With an idempotent request, after requested tasks are successfully launched, subsequent retries using the same client token “abcd” within the same Amazon ECS cluster will not launch any additional tasks. When you use the Amazon SDK or the Amazon Web Services Management Console, a client token is automatically generated and added to RunTask requests (and used in any subsequent retries) if you don’t pass one explicitly.

Amazon ECS now supports idempotency for tasks launched on Amazon Fargate, Amazon EC2 instances, and Amazon ECS Anywhere in all Amazon Web Services regions, including the Amazon Web Services China (Beijing) Region, operated by Sinnet and the Amazon Web Services China (Ningxia) Region, operated by NWCD. To get started with adding idempotency to RunTask API, see the ECS documentation.