This example will introduce how to run AWSOTelCollector Beta in the Docker container. This example uses a AWS data emitter container image that will generate Open Telemetry Protocol (OTLP) format based metrics and traces data to AWS CloudWatch and X-Ray consoles.
Please follow the steps below to try AWS OTel Collector Beta.
If you haven't setup your AWS Credential profile yet, please follow the instruction for setting up your AWS credentials.
aws-otel-collector
source code to get the example configuration in the examples
folder. git clone https://github.com/aws-observability/aws-otel-collector.git
cd aws-otel-collector
aws-otel-collector
instance in Docker using the default
AWS Credential profile. docker run --rm -p 4317:4317 -p 55680:55680 -p 8889:8888 \
-e AWS_REGION=us-west-2 \
-e AWS_PROFILE=default \
-v ~/.aws:/root/.aws \
-v "${PWD}/examples/docker/config-test.yaml":/otel-local-config.yaml \
--name awscollector public.ecr.aws/aws-observability/aws-otel-collector:latest \
--config otel-local-config.yaml;
AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
environment variables. docker run --rm -p 4317:4317 -p 55680:55680 -p 8889:8888 \
-e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" \
-e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" \
-e AWS_REGION=us-west-2 \
-v "${PWD}/examples/docker/config-test.yaml":/otel-local-config.yaml \
--name awscollector public.ecr.aws/aws-observability/aws-otel-collector:latest \
--config otel-local-config.yaml;
Note: The example configuration assumes us-west-2
for the region, modify as necessary.
aws-otel-collector
source code, and open the docker-compose.yaml
under examples
folder.
Please make sure you have the right aws credential path (eg, ~/.aws:/root/.aws
) and the collector config file (eg, ../config.yaml:/etc/otel-agent-config.yaml
) set.
You can also directly use your AWS credential key by setting up these environment variables AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
and AWS_REGION
in the config.
The region is where the data will be sent to.> image: public.ecr.aws/aws-observability/aws-otel-collector:latest
command: ["--config=/etc/otel-agent-config.yaml"]
environment:
- AWS_ACCESS_KEY_ID=<to_be_added>
- AWS_SECRET_ACCESS_KEY=<to_be_added>
- AWS_REGION=<to_be_added>
volumes:
- ../config.yaml:/etc/otel-agent-config.yaml // use default config
- ~/.aws:/root/.aws
docker-compose.yaml
file setup and saved, run the following make command.cd examples; docker-compose up
Now you can view you data in AWS console
AWS Metrics Sample Data
make docker-stop