Amazon ECS Tag Extraction
Incident Management is now generally available! Incident Management is now generally available!

Amazon ECS Tag Extraction

Overview

The Datadog Agent can create and assign tags to all metrics, traces, and logs emitted by a container based on its labels or environment variables.

Unified service tagging

As a best practice in containerized environments, Datadog recommends using unified service tagging when assigning tags. Unified service tagging ties Datadog telemetry together through the use of three standard tags: env, service, and version. To learn how to configure your environment with unified tagging, refer to the dedicated Amazon ECS unified service tagging documentation.

Resource tag collection

If you do not have unified service tagging enabled, complete the following steps to collect ECS resource tags:

  1. Verify your Amazon ECS container instances are associated with an IAM role. This can be done when creating a new cluster with the ECS cluster creation wizard or in the launch configuration used by an autoscaling group.

  2. Update the IAM role used by your Amazon ECS container instances with: ecs:ListTagsForResource.

  3. Update your datadog-agent-ecs.json file (datadog-agent-ecs1.json if you are using an original Amazon Linux AMI) to enable resource tag collection by adding the following environment variable:

        {
          "name": "DD_ECS_COLLECT_RESOURCE_TAGS_EC2",
          "value": "true"
        }
        

Notes

  • Ensure the IAM role is associated with your Amazon ECS container instances and not the underlying EC2 instance.
  • ECS resource tags can be collected from EC2 instances, but not from AWS Fargate.
  • This feature requires Datadog Agent v6.17+ or v7.17+.
  • The Agent supports ECS tag collection from the tasks, services, and container instances ECS resources.

Further reading