How to Run Commands on an AWS ECS Cluster Task or Container


If you need to run a command, or set of commands on an AWS ECS cluster container, then you can do the following:

aws ecs execute-command --cluster ${ClusterName} --task ${TASK_ARN} --container nginx --command "/bin/sh" --interactive