AWS Distro for OpenTelemetry

Use custom OpenTelemetry configuration file from SSM Parameter

Use custom OpenTelemetry configuration file from SSM Parameter

Learn how to upload custom OpenTelemetry configuration file to SSM Parameter store and use it with AWS Distro for OpenTelemetry Collector.




The AWS Distro for OpenTelemetry Collector can optionally be configured via an environment variable AOT_CONFIG_CONTENT. The value of this variable is expected to be a full Collector configuration file; it will override the config file used in the Collector entrypoint command. In ECS, the values of environment variables can be set from AWS Systems Manager Parameters.

1. Update Task Defintion

1.1. Select Task Defintion

Go to AWS Management Console and select Elastic Container Service. From the left side navigation, select Task definition. Select the TaskDefinition we created to run AWS Distro for OpenTelemetry Collector and click the Create new revision button on top.

1.2. Add Environment Variable

From the container definition section, click the AWS Distro for OpenTelemetry Collector container (image: amazon/aws-otel-collector) and go to the Environment variables section. Add a new environment variable- AOT_CONFIG_CONTENT. Select ValueFrom which will tell ECS to get the value from SSM Parameter, and set otel-collector-config (SSM parameter name which we will create in the next section) as the value. Finish updating the task definition and create a new revision.

Diagram



2. Create SSM Parameter

2.1. Go to Parameter Store

Let’s go to System Manager service from AWS Management Console and select Parameter Store from the left side navigation panel.

Diagram

2.2. Create New Parameter

From the top-right corner, click the Create new parameter button. Create a new parameter with the following information. The parameter name should be the same as we used in the environment variable of our task-definition.

  • Name: otel-collector-config
  • Tier: Standard
  • Type: String
  • Data type: Text
  • Value: Copy and paste your custom OpenTelemetry configuration file.

NOTE The collector configuration should not be used to store credentials in plain text. Instead, replacement instructions such as ${env:API_KEY} should be used to load values from an environment variable. These values can be populated either through a secrets manager (or) SSM parameter store on ECS (or) through Kubernetes secrets on EKS




3. Run Task

Run a task with this new Task Defintion and it will use your custom OpenTelemetry comfiguration file from SSM Parameter.