Our next-gen architecture is built to help you make sense of your ever-growing data Watch a 4-min demo video!

Back to All Docs

AWS ECS-EC2 OpenTelemetry Instrumentation AWS ECS-EC2 OpenTelemetry Instrumentation

Last Updated: Apr. 30, 2023

This tutorial demonstrates how to deploy OpenTelemetry to ECS to facilitate the collection of logs, metrics, and traces, and send them to Coralogix.


This implementation utilizes the wrapper image coralogixrepo/otel-coralogix-ecs-ec2, based on the official OpenTelemetry contrib image.


  • The wrapper image is used to dynamically apply the OpenTelemetry configuration at runtime from an environment variable.
  • The image configuration utilizes the otlp receiver for both HTTP (on 4318) and GRPC (on 4317). Data can be sent using either endpoint.




The OpenTelemetry configuration for the agent is stored in a Base64-encoded environment variable and is applied at runtime. This allows you to dynamically pass any configuration values you choose as a parameter to CloudFormation.

Use either of the following configuration examples or combine them to send Coralogix your logs, metrics, and traces.


  • The configuration examples work directly with the coralogixrepo/otel-coralogix-ecs-wrapper docker image for ECS.
  • The Coralogix Exporter enables the use of enrichments such as dynamic application or subsystem name, defined using application_name_attributes and subsystem_name_attributes, respectively.

ECS Cluster

Deploy a new ECS cluster. If you already have an existing ECS Cluster, skip this step.

STEP 1. Deploy a new ECS cluster:

ecs-cli up --region <region> --keypair <your-key-pair> --cluster <cluster-name> --size <no. of instances> --capability-iam 

Note: The --keypair flag and STEP 2 are not mandatory. However, if no Key Pair is supplied, you will be unable to connect to any of the EC2 instances in the cluster via SSH.

STEP 2. Create a key pair using the command below:

aws ec2 create-key-pair --key-name MyKeyPair --query 'KeyMaterial' --output text > MyKeyPair.pem

STEP 3. Control default values.

The ecs-cli up command will leverage CloudFormation to create an ECS Cluster. Default values will be used to create and configure a VPC and Subnets. These values can also be controlled using:

ecs-cli up --help

ECS Task Definition & Service

Deploy a Task Definition, used by ECS to create an ECS Service to run OpenTelemetry.

STEP 1. Deploy this CloudFormation template, ensuring that all the necessary parameters are provided. You are required to input:

STEP 2. Once the template is deployed, verify that the container is running:

ecs-cli ps --region <region> -c <cluster name>


Need help?

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us via our in-app chat or by sending us an email at [email protected].

On this page