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

OpenTelemetry using ECS-EC2 OpenTelemetry using ECS-EC2

Last Updated: Jan. 31, 2023

This guide shows you how to create a Docker image that is based on v0.62.0 release of OpenTelemetry Collector and send your data to Coralogix. By creating a specific image that forwards your metrics and traces to Coralogix, Coralogix allows you to run your application on ECS together with our container image.

Prerequisites

1. Sign up for a Coralogix account. Set up your account on the Coralogix domain corresponding to the region within which you would like your data stored.

2. Access your Coralogix private key.

3. Create an active AWS account with the relevant permissions.

Create an Amazon ECS Cluster

1. Log into the AWS Portal and search for the Amazon Elastic Container Service page.

2. Select Create cluster.

3. Select EC2 Linux + Networking. Click Next step.

4. Configure the cluster.

  • Define Cluster name.
  • Under ‘Instance configuration’:
    • Choose an EC2 Instance type.
    • Select your preferred EC2 AMI ID.
    • Select a Key pair to access the Instance.
  • Under ‘Networking’:
    • Select an existing VPC or create a new one.
    • Select one of the available Subnets within the VPC.
    • Enable Auto assign public IP
    • It is recommended to leave the default port range value to 80. This will expose the GRPC receiver endpoint in our OTEL collector in our the Coralogix security group by default.
  • Click Create. The cluster will be automatically deployed.

5. When complete, click View Cluster.

Set the Task Definition

To begin sending telemetry data from your ECS – EC2 instance to Coralogix, you will need to create a new Task Definition.

1. In your ECS console, select Task Definitions > Create new Task Definition.

2. Select launch type compatibility: EC2 > Next step.

3. Configure task and container definitions.

  • Input task definition name.
  • Input value for Memory or Memory Reservation.
  • Under ‘Volumes’ > Configure via JSON.
  • Paste the following in the JSON file:
{
    "ipcMode": null,
    "executionRoleArn": null,
    "containerDefinitions": [
        {
            "dnsSearchDomains": null,
            "environmentFiles": [],
            "logConfiguration": null,
            "entryPoint": [],
            "portMappings": [
                {
                    "hostPort": 0,
                    "protocol": "tcp",
                    "containerPort": 4317
                }
            ],
            "command": [],
            "linuxParameters": null,
            "cpu": 0,
            "environment": [
                {
                    "name": "OTEL_RESOURCE_ATTRIBUTES",
                    "value": "APP_NAME=Otel,SUB_SYS=OTEL"
                },
                {
                    "name": "PRIVATE_KEY",
                    "value": ""
                },
                {
                    "name": "TRACES_ENDPOINT",
                    "value": "otel-traces.<domain>:443"
                },
                {
                    "name": "METRICS_ENDPOINT",
                    "value": "otel-metrics.<domain>:443"
                }
            ],
            "resourceRequirements": null,
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [
                {
                    "sourceVolume": "hostfs",
                    "containerPath": "/hostfs",
                    "readOnly": ""
                }
            ],
            "workingDirectory": null,
            "secrets": null,
            "dockerSecurityOptions": null,
            "volumesFrom": null,
            "stopTimeout": null,
            "image": "coralogixrepo/otel-coralogix-ecs",
            "startTimeout": null,
            "firelensConfiguration": null,
            "dependsOn": null,
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": null,
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": null,
            "name": "otel",
            "repositoryCredentials": {
                "credentialsParameter": ""
            }
        }
    ],
    "taskRoleArn": "",
    "family": "Otel",
    "pidMode": null,
    "requiresCompatibilities": [
        "EC2"
    ],
    "networkMode": "bridge",
    "runtimePlatform": null,
    "inferenceAccelerators": [],
    "proxyConfiguration": null,
    "volumes": [
        {
            "host": {
                "sourcePath": "/"
            },
            "name": "hostfs"
        }
    ],
    "placementConstraints": [],
    "tags": []
}
  • In order to send your data to Coralogix, you are required to declare particular variables in your template:
    • TRACES_ENDPOINT: In order to send traces to Coralogix, you will need to include your account’s specific domain in the Coralogix endpoint: otel-traces.<domain>:443.
    • METRICS_ENDPOINT: In order to send metrics to Coralogix, you will need to include your account’s specific domain in the Coralogix endpoint: otel-metrics.<domain>:443.
    • PRIVATE_KEY: Access your Coralogix private key. Ensure that this sensitive information remains protected and unexposed.
    • OTEL_RESOURCE_ATTRIBUTES : Defines your application & subsystem names. If unchanged, this sets your application name to “Otel” and subsystem name to “OTEL.”
  • Once complete, click Save.
  • Note! View the configuration and Docker file in this repository.

Running the Task as Daemonset

1. In your cluster, click Create under the Service tab.

2. Under ‘Configure service’:

  • Launch type: EC2
  • Define Cluster and Service name
  • Service type: DAEMON
  • Define Number of tasks

3. Under ‘Configure network’:

  • Choose Cluster VPC and subnets.

4. Review and click Create Service.

5. Click View Service.

Additional Resources

GithubOfficial OpenTelemetry Collector with Coralogix Exporter
FeaturesCoralogix APM features
APM using Amazon EC2

Support

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