amazon-web-servicesdockeramazon-ecs

How do I capture the console output for a container launched on ECS?


When I launch a container using docker run the command prompt shows a lot of useful information that's invaluable while debugging.

Is there a mechanism is ECS that allows me to capture this information? At the moment, I'm SSH'ing into the container and launching containers manually to debug them, which is not ideal.


Solution

  • Yep. You can use CloudWatch Logs in combination with ECS. It does require a bit more setup, but once done all container logs will be streamed into CloudWatch Logs which means it can be viewed from the AWS console.

    General CloudWatch Log integration with ECS is explained here. Using the awslogs Driver as part of your task definitions is explained in more detail here.

    Hope that helps.