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 ADOT Collector Beta.
If you haven't setup your AWS Credential profile yet, please follow the instruction for setting up your AWS credentials.
- Checkout
aws-otel-collector
source code to get the example configuration in theexamples
folder.
git clone https://github.com/aws-observability/aws-otel-collector.git
cd aws-otel-collector
- Start the
aws-otel-collector
instance in Docker using thedefault
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;
- or by setting the
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.
- Checkout
aws-otel-collector
source code, and open thedocker-compose.yaml
underexamples
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 variablesAWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
andAWS_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
- Once you have the
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
- X-Ray - aws console
- CloudWatch - aws console
AWS Metrics Sample Data
- Stop the running AWSOTelCollector in Docker container
make docker-stop