v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1456373564.1 KB

Runs a command remotely on a container within a task.

If you use a condition key in your IAM policy to refine the conditions for the policy statement, for example limit the actions to a specific cluster, you receive an AccessDeniedException when there is a mismatch between the condition key value and the corresponding parameter value.

For information about required permissions and considerations, see Using Amazon ECS Exec for debugging in the Amazon ECS Developer Guide.

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

Headers

X-Amz-Target'AmazonEC2ContainerServiceV20141113.ExecuteCommand' required

Request body

clusterstring

The Amazon Resource Name (ARN) or short name of the cluster the task is running in. If you do not specify a cluster, the default cluster is assumed.

containerstring

The name of the container to execute the command on. A container name only needs to be specified for tasks containing multiple containers.

commandstring required

The command to run on the container.

interactiveboolean required

Use this flag to run your command in interactive mode.

taskstring required

The Amazon Resource Name (ARN) or ID of the task the container is part of.

Response

Success

clusterArnstring

The Amazon Resource Name (ARN) of the cluster.

containerArnstring

The Amazon Resource Name (ARN) of the container.

containerNamestring

The name of the container.

interactiveboolean

Determines whether the execute command session is running in interactive mode. Amazon ECS only supports initiating interactive sessions, so you must specify <code>true</code> for this value.

taskArnstring

The Amazon Resource Name (ARN) of the task.