Query Amazon CloudWatch metrics using PromQL
You can query Amazon CloudWatch metrics using PromQL by configuring an Amazon Managed Service for Prometheus data source that points to the CloudWatch PromQL endpoint. This approach lets you use PromQL syntax to query metrics that are ingested into CloudWatch through OpenTelemetry Protocol (OTLP).
AWS resource enrichment automatically adds labels such as
aws_account_id, aws_region, and resource tags to
your metrics. You can use these labels in your PromQL queries for filtering and
aggregation.
Before you configure the CloudWatch PromQL data source, verify the following requirements:
-
OpenTelemetry metrics in CloudWatch ingestion is enabled in your CloudWatch account.
-
Amazon Managed Grafana workspace version 12.4 or later.
-
Amazon Managed Service for Prometheus plugin version 3.0.0 or later.
-
IAM permissions for
cloudwatch:GetMetricDataandcloudwatch:ListMetrics.
To configure the CloudWatch PromQL data source
-
In your Amazon Managed Grafana workspace, choose Connections in the navigation pane, then choose Data sources.
-
Choose Add data source, then choose Amazon Managed Service for Prometheus.
-
For Prometheus server URL, enter the CloudWatch PromQL endpoint for your Region:
https://monitoring..region.amazonaws.com -
Under Authentication, choose SigV4 as the authentication method.
-
Under SigV4 Auth Details, for Service, enter
monitoring. -
Choose Save & test to verify the connection.
After you save the data source, you can use PromQL queries in Explore and dashboards to query CloudWatch metrics that are ingested through OTLP.
For more information about OpenTelemetry metrics ingestion and PromQL queries
in Amazon CloudWatch, see Introducing OpenTelemetry and PromQL support in Amazon CloudWatch