I have a log file (example: apilog.txt) inside my docker container running in an EC2 instance.

I need to push the content in that file to AWS Cloudwatch log groups.

How can I achieve this task .

Thanks in Advance

1 Answer 1


Option 1 - Use ECS instead of EC2+docker. ECS is the same thing (EC2+docker) but better because it's integrated with other AWS services like CloudWatch and the container logs are automatically fed into CloudWatch Logs.

Option 2 - Use CloudWatch Logs logging agent in Docker

Option 3 - Use standalone CloudWatch Logs Agent that can read log files and feed them to CloudWatch.

Hope that helps :)

  • Hello MLu, I am actually using ECS only, I am pushing docker logs to Cloud watch but I need to push a file that is inside the container, not the container logs, Jun 23, 2020 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.