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 requests 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 AWS SDK or the AWS Management Console, a client token is automatically generated and added to RunTask requests (and used in any subsequent retries) if you do not pass one explicitly.
Amazon ECS now supports idempotency for task launches on AWS Fargate, Amazon EC2 instances, and Amazon ECS Anywhere in all AWS regions. To get started with adding idempotency to RunTask API requests, see the ECS documentation at https://docs.aws.amazon.com/AmazonECS/latest/APIReference/ECS_Idempotency.html