AWS Distro for OpenTelemetry
Cloudformation Template for collecting ECS EC2 instance metrics
Cloudformation Template for collecting ECS EC2 instance metrics
In this tutorial, we will demonstrate how to run OpenTelemetry Collector (ADOT Collector) as a daemon on the Amazon Elastic Container Service (Amazon ECS) in Amazon Elastic Compute Cloud (Amazon EC2) mode.
To Install ADOT Collector by using CloudFormation, you have to have a cluster. If you are not familiar with how to create a cluster, you can check this create-cluster section.
Setup for ECS EC2 to get instance metrics
- Download the CloudFormation template file for installing ADOT Collector for ECS EC2. Run the following curl command.
curl -O https://raw.githubusercontent.com/aws-observability/aws-otel-collector/main/deployment-template/ecs/aws-otel-ec2-instance-metrics-daemon-deployment-cfn.yaml
- Replace the <PATH_TO_CloudFormation_TEMPLATE> with the path where your template saved in the command, and export the
following parameters, and then run CloudFormation command.
Cluster_Name
- ECS Cluster name setup in Prerequisite stepAWS_Region
- Region the data will be sentPATH_TO_CloudFormation_TEMPLATE
- CFN template path downloaded in Step 1command
- Assign value to the command variable to select the config file path; the ADOT Collector--config=/etc/ecs/otel-instance-metrics-config.yaml
- To consume ECS EC2 instance metrics
1ClusterName=<Cluster_Name>2Region=<AWS_Region>3command=<command>4aws cloudformation create-stack --stack-name AOCECS-${ClusterName}-${Region} \5 --template-body file://<PATH_TO_CloudFormation_TEMPLATE> \6 --parameters ParameterKey=ClusterName,ParameterValue=${ClusterName} \7 ParameterKey=CreateIAMRoles,ParameterValue=True \8 ParameterKey=command,ParameterValue=${command} \9 --capabilities CAPABILITY_NAMED_IAM \10 --region ${Region}
- Go to you ECS Console and see if the task is running.
- Go to the Results section to learn how to check the collected metrics and traces.