

# Enabling vended metrics in PromQL
<a name="CloudWatch-OTelEnrichment"></a>

**Tip**  
To learn more about OpenTelemetry on CloudWatch, check out the [Cloud Operations Enablement workshop and event series](https://aws-experience.com/amer/smb/events/series/Cloud-Operations-Enablement).

You can enable OTel enrichment to make vended metrics for [supported Amazon resources](https://docs.amazonaws.cn//AmazonCloudWatch/latest/monitoring/UsingResourceTagsForTelemetry.html) queryable via PromQL. Once enabled, metrics that contain a resource identifier dimension (for example, EC2 CPUUtilization with an InstanceId dimension) are enriched with resource ARN and resource tag labels and become queryable using PromQL.

The enriched metric preserves the original metric name and CloudWatch dimensions, and adds:
+ **Resource attributes** – the resource ARN (`cloud.resource_id`), cloud provider, region, and account ID.
+ **Instrumentation scope** – identifies the source service and marks the metric as OTel-enriched.
+ **Resource tags** – any Amazon resource tags associated with the resource, queryable as PromQL labels.

The original classic CloudWatch metric is not modified and remains available through existing CloudWatch APIs.

## Enabling OpenTelemetry enrichment for vended metrics
<a name="CloudWatch-OTelEnrichment-Enable"></a>

Before you start OTel enrichment, you must [enable resource tags on telemetry](https://docs.amazonaws.cn//AmazonCloudWatch/latest/monitoring/EnableResourceTagsOnTelemetry.html) for your account.

You can enable OTel enrichment for your account in a specific region using the CloudWatch console, Amazon CLI, Amazon CloudFormation, Terraform, or Amazon SDK.

You will need permissions for the following operation: `cloudwatch:StartOTelEnrichment`

**To enable OTel enrichment for Amazon metrics (CloudWatch Console)**

1. Open the CloudWatch console at [https://console.amazonaws.cn/cloudwatch/](https://console.amazonaws.cn/cloudwatch/).

1. In the navigation pane, choose **CloudWatch**, then choose **Settings**.

1. In the **Enable OTel Enrichment for Amazon Metrics** pane, toggle the feature On.

**Amazon CLI**

```
aws cloudwatch start-otel-enrichment
```

**Amazon CloudFormation**

```
Resources:
  OTelEnrichment:
    Type: AWS::CloudWatch::OTelEnrichment
```

**Terraform**

**Note**  
The `aws_cloudwatch_otel_enrichment` Terraform resource requires the `aws_observabilityadmin_telemetry_enrichment` resource to be configured first.

```
resource "aws_observabilityadmin_telemetry_enrichment" "example" {
}

resource "aws_cloudwatch_otel_enrichment" "example" {
  depends_on = [aws_observabilityadmin_telemetry_enrichment.example]
}
```

For more information, see [aws\_cloudwatch\_otel\_enrichment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_otel_enrichment) in the Terraform Registry.

To enable across multiple regions, create the same resource in each regional stack or invoke the API in each region of interest.

Once enrichment is enabled, you can start querying vended metrics via PromQL. See: [Querying vended Amazon metrics with PromQL](CloudWatch-PromQL-Querying.md#CloudWatch-PromQL-Querying-Vended).