Connect to a running container in AWS ECS Cluster

Viewed 1809

My team inherited an AWS ECS Cluster with multiple linked containers running on it, but without the source code (yeah, I know...). We need to connect to one of the running containers and execute a few commands in it. Here's what we tried:

How else could we connect to a container running on AWS ECS?

UPDATE:

I tried accessing the container with AWS CLI following an example here, only to find out that execute command was not enabled in the task:

An error occurred (InvalidParameterException) when calling the ExecuteCommand operation: The execute command failed because execute command was not enabled when the task was run or the execute command agent isn’t running. Wait and try again or run a new task with execute command enabled and try again.

Is now a good time to give up?

1 Answers

If exec command wasn't enabled on the task when it was created, and it's running in Fargate instead of EC2, then there's no way to connect to it like you are trying to do.

Are the docker images in ECR? You should be able to examine the ECS task definitions to see where the Docker images are, then pull down the Docker images to an EC2 server or your local computer, at which point you should be able to get to the contents of those Docker images.

Related