v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1456373564.1 KB

Stops a running task. Any tags associated with the task will be deleted.

When StopTask is called on a task, the equivalent of docker stop is issued to the containers running in the task. This results in a SIGTERM value and a default 30-second timeout, after which the SIGKILL value is sent and the containers are forcibly stopped. If the container handles the SIGTERM value gracefully and exits within 30 seconds from receiving it, no SIGKILL value is sent.

The default 30-second timeout can be configured on the Amazon ECS container agent with the ECS_CONTAINER_STOP_TIMEOUT variable. For more information, see Amazon ECS Container Agent Configuration in the Amazon Elastic Container Service Developer Guide.

post/#X-Amz-Target=AmazonEC2ContainerServiceV20141113.StopTask

Headers

X-Amz-Target'AmazonEC2ContainerServiceV20141113.StopTask' required

Request body

clusterstring

The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to stop. If you do not specify a cluster, the default cluster is assumed.

taskstring required

The task ID of the task to stop.

reasonstring

An optional message specified when a task is stopped. For example, if you're using a custom scheduler, you can use this parameter to specify the reason for stopping the task here, and the message appears in subsequent <a>DescribeTasks</a> API operations on this task. Up to 255 characters are allowed in this message.

Response

Success