Amazon ECS now allows you to execute commands in a container running on Amazon EC2 or AWS Fargate

Amazon Elastic Container Service (Amazon ECS) introduces Amazon ECS Exec – a simple, secure, and auditable way for customers to execute commands in a container running on Amazon Elastic Compute Cloud (Amazon EC2) instances or AWS Fargate. ECS Exec gives you interactive shell or single command access to a running container making it easier to debug issues, diagnose errors, collect one-off dumps and statistics, and interact with processes in the container.

Source:: Amazon AWS