AWS Open Distro for OpenTelemetry

Run AWS OTel Collector Examples with Docker

Run AWS OTel Collector Examples with Docker

This example will introduce how to install AWS OTel Collector to collect metrics/traces data from a sample application running in the Docker container. The sample application will generate Open Telemetry Protocol (OTLP) format based metrics and traces data and send to AWS CloudWatch and X-Ray consoles.

Please follow the steps below to try AWS OTel Collector.


  1. To retrieve your AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION for the following example, please see here for setting up your AWS credentials.
  2. Installed docker runtime on your laptop.


  1. Download the source code in this repo and enter into examples folder. Open and Edit docker-compose.yaml file with the expected AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION in the section below. The region is where the data will be sent to.

(Note, if you can’t access the repo, you can download docker-compose.yaml file at here and edit AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION with the expected values.

image: amazon/aws-otel-collector:latest
command: ["--config=/etc/otel-agent-config.yaml"]
- AWS_ACCESS_KEY_ID=<to_be_added>
- AWS_SECRET_ACCESS_KEY=<to_be_added>
- AWS_REGION=<to_be_added>
- ../config.yaml:/etc/otel-agent-config.yaml // use default config
- ~/.aws:/root/.aws
- "1777:1777" # pprof extension
- "55679:55679" # zpages extension
- "55680:55680" # OTLP receiver
- "13133" # health_check
  1. Once AWS credential has been updated in the docker-compose.yaml file, run the following command within the same folder where the docker-compose.yaml file is located.
cd examples; docker-compose up -d
  1. Once AWS OTel Collector and Sample application docker images are up and running. We can check the monitoring data in CloudWatch and X-Ray consoles.

  2. CloudWatch Metrics console - (AOCDockerDemo/AOCDockerDemoService)

  3. AWS X-Ray Console

  4. To stop this demo with AWS OTel Collector, please run the following command.

docker stop $(docker ps -aq)

On this page