6

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 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

2 Comments

yeah, the images sit in the AWS ECR repo and we know exactly what's in them, but it's a matter of fixing the current deployment by running a couple of commands inside of one of the containers. There are other workarounds to implement this fix, but way more complicated than what I attempted above. Anyway, thanks for your asnwer!
You'll have to restart the tasks to enable the ECS exec feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.