aws ecs execute-command
Runs a command remotely on a container within a task. AWS CLI reference
1 example 5 options Its page in the AWS CLI reference
Examples
To run an interactive /bin/sh command
The following execute-command example runs an interactive /bin/sh command against a container named MyContainer for a task with an id of arn:aws:ecs:us-west-2:123456789012:task/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE.
aws ecs execute-command --cluster MyCluster --task arn:aws:ecs:us-west-2:123456789012:task/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE --container MyContainer --interactive --command "/bin/sh"Identify--clusterThe Amazon Resource Name (ARN) or short name of the cluster the task is running in.--taskThe Amazon Resource Name (ARN) or ID of the task the container is part of.--containerThe name of the container to execute the command on.--interactiveUse this flag to run your command in interactive mode.--commandThe command to run on the container.This command produces no output.
For more information, see Using Amazon ECS Exec for debugging in the Amazon ECS Developer Guide.
Options
--clusterThe Amazon Resource Name (ARN) or short name of the cluster the task is running in.--commandThe command to run on the container.--containerThe name of the container to execute the command on.--non-interactive, --interactiveUse this flag to run your command in interactive mode.--taskThe Amazon Resource Name (ARN) or ID of the task the container is part of.