<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Amazon CloudWatch data source on Grafana Labs</title><link>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/</link><description>Recent content in Amazon CloudWatch data source on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v13.2/datasources/aws-cloudwatch/index.xml" rel="self" type="application/rss+xml"/><item><title>Configure CloudWatch</title><link>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/</link><pubDate>Tue, 18 Aug 2026 10:15:08 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/</guid><content><![CDATA[&lt;h1 id=&#34;configure-the-amazon-cloudwatch-data-source&#34;&gt;Configure the Amazon CloudWatch data source&lt;/h1&gt;
&lt;p&gt;This document provides instructions for configuring the Amazon CloudWatch data source and explains available configuration options. For general information on adding and managing data sources, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/administration/data-source-management/&#34;&gt;Data source management&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You must have the &lt;code&gt;Organization administrator&lt;/code&gt; role to configure the CloudWatch data source. Organization administrators can also &lt;a href=&#34;#provision-the-data-source&#34;&gt;configure the data source via YAML&lt;/a&gt; with the Grafana provisioning system.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Grafana comes with a built-in CloudWatch data source plugin, so you do not need to install a plugin.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Familiarize yourself with your CloudWatch security configuration and gather any necessary security certificates, client certificates, and client keys.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;key-concepts&#34;&gt;Key concepts&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re new to AWS, these terms are used throughout the configuration:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Term&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;IAM policy&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A JSON document attached to an identity that grants permissions to AWS API actions.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;IAM role&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An identity with permissions that trusted entities can assume temporarily, instead of using long-lived keys.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Assume role&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An AWS mechanism that lets one identity temporarily take on the permissions of an IAM role, often used for cross-account access.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;External ID&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A shared value in a role&amp;rsquo;s trust policy that prevents another party from assuming the role on your behalf.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;STS (Security Token Service)&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The AWS service that issues the short-lived temporary credentials used when assuming a role.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Cross-account observability (OAM)&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An AWS feature, managed through Observability Access Manager, that links monitoring and source accounts so you can query metrics and logs across accounts.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;add-the-cloudwatch-data-source&#34;&gt;Add the CloudWatch data source&lt;/h2&gt;
&lt;p&gt;Complete the following steps to set up a new CloudWatch data source:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Connections&lt;/strong&gt; in the left-side menu.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add new connection&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;CloudWatch&lt;/code&gt; in the search bar.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;CloudWatch data source&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add new data source&lt;/strong&gt; in the upper right.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Grafana takes you to the &lt;strong&gt;Settings&lt;/strong&gt; tab, where you will set up your CloudWatch configuration.&lt;/p&gt;
&lt;h2 id=&#34;configure-the-data-source-in-the-ui&#34;&gt;Configure the data source in the UI&lt;/h2&gt;
&lt;p&gt;The following are configuration options for the CloudWatch data source.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;&lt;strong&gt;Setting&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The data source name. Sets the name you use to refer to the data source in panels and queries.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Default&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Toggle to select as the default name in dashboard panels. When you go to a dashboard panel, this will be the default selected data source.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Grafana plugin requests to AWS are made on behalf of an AWS Identity and Access Management (IAM) role or IAM user.
The IAM user or IAM role must have the associated policies to perform certain API actions.&lt;/p&gt;
&lt;p&gt;For authentication options and configuration details, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/&#34;&gt;AWS authentication&lt;/a&gt;.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Authentication Provider&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Specify which AWS credentials chain to use. A Grafana plugin&amp;rsquo;s requests to AWS are made on behalf of an IAM role or IAM user. The IAM user or IAM role must have the necessary policies to perform the required API actions.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;strong&gt;Access &amp;amp; secret key:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You must use both an access key ID and a secret access key to authenticate.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Access Key ID&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Enter your key ID.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Secret Access Key&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Enter the secret access key.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;strong&gt;Credentials file:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When you select the &lt;strong&gt;Credentials file&lt;/strong&gt; authentication provider, you can specify which profile to read from the AWS shared credentials file.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Credentials Profile Name&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The profile name in &lt;code&gt;~/.aws/credentials&lt;/code&gt;, as specified in the credentials file. Leave blank to use the &lt;code&gt;default&lt;/code&gt; profile.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;strong&gt;Assume Role&lt;/strong&gt;:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Assume Role ARN&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Optional.&lt;/em&gt; Specify the ARN of an IAM role to assume. This ensures the selected authentication method is used to assume the role, not used directly.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;External ID&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;If you&amp;rsquo;re assuming a role in another AWS account that requires an external ID, specify it here.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;strong&gt;Additional Settings:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Endpoint&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Optional&lt;/em&gt;. Specify a custom endpoint for the AWS service.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Default Region&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Specify the AWS region. Example: If the region is US West (Oregon), use &lt;code&gt;us-west-2&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Namespaces of Custom Metrics&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Add one or more custom metric namespaces, separated by commas (for example,&lt;code&gt;Namespace1,Namespace2&lt;/code&gt;). Grafana can&amp;rsquo;t automatically load custom namespaces using the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch GetMetricData API&lt;/a&gt;. To make custom metrics available in the query editor, manually specify the namespaces in the &lt;code&gt;Namespaces of Custom Metrics&lt;/code&gt; field in the data source configuration.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;strong&gt;Proxy configuration:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Proxy Configuration&lt;/strong&gt; settings appear only when per-data source HTTP proxy support is enabled with the &lt;code&gt;per_datasource_http_proxy_enabled&lt;/code&gt; option in the Grafana configuration file. They let each CloudWatch data source use its own outbound HTTP proxy for AWS requests.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Proxy Type&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Select how the proxy is configured: &lt;code&gt;Environment (default)&lt;/code&gt; uses the &lt;code&gt;HTTP_PROXY&lt;/code&gt; and &lt;code&gt;HTTPS_PROXY&lt;/code&gt; environment variables, &lt;code&gt;None&lt;/code&gt; disables the proxy, and &lt;code&gt;URL&lt;/code&gt; lets you specify a proxy URL. Don&amp;rsquo;t set this when Secure Socks Proxy is enabled.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Proxy URL&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Only when Proxy Type is &lt;code&gt;URL&lt;/code&gt;.&lt;/em&gt; The proxy URL, for example &lt;code&gt;https://localhost:3004&lt;/code&gt;. Don&amp;rsquo;t include the username or password in the URL.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Proxy Username&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Only when Proxy Type is &lt;code&gt;URL&lt;/code&gt;.&lt;/em&gt; &lt;em&gt;Optional.&lt;/em&gt; The proxy username.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Proxy Password&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Only when Proxy Type is &lt;code&gt;URL&lt;/code&gt;.&lt;/em&gt; &lt;em&gt;Optional.&lt;/em&gt; The proxy password.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;strong&gt;CloudWatch Logs&lt;/strong&gt;:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Query Result Timeout&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Grafana polls CloudWatch Logs every second until AWS returns a &lt;code&gt;Done&lt;/code&gt; status or the timeout is reached. An error is returned if the timeout is exceeded. For alerting, the timeout defined in the Grafana configuration file takes precedence. Enter a valid duration string, such as &lt;code&gt;30m&lt;/code&gt;, &lt;code&gt;30s&lt;/code&gt; or &lt;code&gt;200ms&lt;/code&gt;. The default is &lt;code&gt;30m&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Default Log Groups&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Optional&lt;/em&gt;. Specify the default log groups for CloudWatch Logs queries.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;strong&gt;Application Signals trace link:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Data source&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Select the Application Signals data source from the drop-down menu.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Grafana automatically creates a link to a trace in Application Signals data source if logs contain the &lt;code&gt;@xrayTraceId&lt;/code&gt; field. To use this feature, you must already have an Application Signals data source configured. For details, refer to the &lt;a href=&#34;/docs/plugins/grafana-x-ray-datasource/latest/&#34;&gt;Application Signals data source docs&lt;/a&gt;. To view the Application Signals link, select the log row in either the Explore view or dashboard 
    &lt;a href=&#34;/docs/grafana/v13.2/panels-visualizations/visualizations/logs/&#34;&gt;Logs panel&lt;/a&gt; to view the log details section.&lt;/p&gt;
&lt;p&gt;To log the &lt;code&gt;@xrayTraceId&lt;/code&gt;, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS Application Signals documentation&lt;/a&gt;. To provide the field to Grafana, your log queries must also contain the &lt;code&gt;@xrayTraceId&lt;/code&gt; field, for example by using the query &lt;code&gt;fields @message, @xrayTraceId&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Private data source connect&lt;/strong&gt; - &lt;em&gt;Only for Grafana Cloud users.&lt;/em&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Private data source connect&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Establishes a private, secured connection between a Grafana Cloud stack and data sources within a private network. Use the drop-down to locate the PDC URL. For setup instructions, refer to &lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/&#34;&gt;Private data source connect (PDC)&lt;/a&gt; and &lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/configure-pdc/#configure-grafana-private-data-source-connect-pdc&#34;&gt;Configure PDC&lt;/a&gt;. Click &lt;strong&gt;Manage private data source connect&lt;/strong&gt; to open your PDC connection page and view your configuration details.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;After configuring your Amazon CloudWatch data source options, click &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; at the bottom to test the connection. When the test succeeds, Grafana confirms that it reached both CloudWatch APIs:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;1. Successfully queried the CloudWatch metrics API.
2. Successfully queried the CloudWatch logs API.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link&#34;
        href=&#34;/media/docs/CloudWatch/CloudWatch-config-success-message.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload &#34;
          data-src=&#34;/media/docs/CloudWatch/CloudWatch-config-success-message.png&#34;alt=&#34;&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/CloudWatch/CloudWatch-config-success-message.png&#34;
            alt=&#34;&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;/a&gt;&lt;/figure&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;To troubleshoot issues while setting up the CloudWatch data source, check the &lt;code&gt;/var/log/grafana/grafana.log&lt;/code&gt; file. Common issues include invalid credentials, missing regions and metrics-only credentials.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;iam-policy-examples&#34;&gt;IAM policy examples&lt;/h3&gt;
&lt;p&gt;To read CloudWatch metrics and EC2 tags, instances, regions, and alarms, you must grant Grafana permissions via IAM.
You can attach these permissions to the IAM role or IAM user you configured in 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/&#34;&gt;AWS authentication&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Metrics-only permissions:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
  &amp;#34;Statement&amp;#34;: [
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingMetricsFromCloudWatch&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: [
        &amp;#34;CloudWatch:DescribeAlarmsForMetric&amp;#34;,
        &amp;#34;CloudWatch:DescribeAlarmHistory&amp;#34;,
        &amp;#34;CloudWatch:DescribeAlarms&amp;#34;,
        &amp;#34;CloudWatch:ListMetrics&amp;#34;,
        &amp;#34;CloudWatch:GetMetricData&amp;#34;,
        &amp;#34;CloudWatch:GetInsightRuleReport&amp;#34;
      ],
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingTagsInstancesRegionsFromEC2&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: [&amp;#34;ec2:DescribeTags&amp;#34;, &amp;#34;ec2:DescribeInstances&amp;#34;, &amp;#34;ec2:DescribeRegions&amp;#34;],
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingResourcesForTags&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: &amp;#34;tag:GetResources&amp;#34;,
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingResourceMetricsFromPerformanceInsights&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: &amp;#34;pi:GetResourceMetrics&amp;#34;,
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Logs-only permissions:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
  &amp;#34;Statement&amp;#34;: [
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingLogsFromCloudWatch&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: [
        &amp;#34;logs:DescribeLogGroups&amp;#34;,
        &amp;#34;logs:ListAggregateLogGroupSummaries&amp;#34;,
        &amp;#34;logs:GetLogGroupFields&amp;#34;,
        &amp;#34;logs:StartQuery&amp;#34;,
        &amp;#34;logs:StopQuery&amp;#34;,
        &amp;#34;logs:GetQueryResults&amp;#34;,
        &amp;#34;logs:GetLogEvents&amp;#34;
      ],
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingTagsInstancesRegionsFromEC2&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: [&amp;#34;ec2:DescribeTags&amp;#34;, &amp;#34;ec2:DescribeInstances&amp;#34;, &amp;#34;ec2:DescribeRegions&amp;#34;],
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingResourcesForTags&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: &amp;#34;tag:GetResources&amp;#34;,
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Metrics and logs permissions:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
  &amp;#34;Statement&amp;#34;: [
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingMetricsFromCloudWatch&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: [
        &amp;#34;CloudWatch:DescribeAlarmsForMetric&amp;#34;,
        &amp;#34;CloudWatch:DescribeAlarmHistory&amp;#34;,
        &amp;#34;CloudWatch:DescribeAlarms&amp;#34;,
        &amp;#34;CloudWatch:ListMetrics&amp;#34;,
        &amp;#34;CloudWatch:GetMetricData&amp;#34;,
        &amp;#34;CloudWatch:GetInsightRuleReport&amp;#34;
      ],
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingResourceMetricsFromPerformanceInsights&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: &amp;#34;pi:GetResourceMetrics&amp;#34;,
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingLogsFromCloudWatch&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: [
        &amp;#34;logs:DescribeLogGroups&amp;#34;,
        &amp;#34;logs:ListAggregateLogGroupSummaries&amp;#34;,
        &amp;#34;logs:GetLogGroupFields&amp;#34;,
        &amp;#34;logs:StartQuery&amp;#34;,
        &amp;#34;logs:StopQuery&amp;#34;,
        &amp;#34;logs:GetQueryResults&amp;#34;,
        &amp;#34;logs:GetLogEvents&amp;#34;
      ],
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingTagsInstancesRegionsFromEC2&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: [&amp;#34;ec2:DescribeTags&amp;#34;, &amp;#34;ec2:DescribeInstances&amp;#34;, &amp;#34;ec2:DescribeRegions&amp;#34;],
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    },
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingResourcesForTags&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: &amp;#34;tag:GetResources&amp;#34;,
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;cross-account-observability-permissions&#34;&gt;Cross-account observability permissions&lt;/h4&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
  &amp;#34;Statement&amp;#34;: [
    {
      &amp;#34;Action&amp;#34;: [&amp;#34;oam:ListSinks&amp;#34;, &amp;#34;oam:ListAttachedLinks&amp;#34;],
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Cross-account observability lets you retrieve metrics and logs across different accounts in a single region, but you can&amp;rsquo;t query EC2 Instance Attributes across accounts because those come from the EC2 API and not the CloudWatch API.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;For more information on configuring authentication, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/&#34;&gt;Configure AWS authentication&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;permissions-reference&#34;&gt;Permissions reference&lt;/h3&gt;
&lt;p&gt;The following table explains why each permission is needed and whether it&amp;rsquo;s required, so you can scope a policy to only the features you use. Grant &lt;code&gt;cloudwatch:GetMetricData&lt;/code&gt; only for metrics, the &lt;code&gt;logs:&lt;/code&gt; actions only for logs, and the EC2 and tag actions only if you use the related template variables. Granting a permission that you don&amp;rsquo;t use has no effect on functionality.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Permission&lt;/th&gt;
              &lt;th&gt;Purpose&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloudwatch:ListMetrics&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Lists available metrics and populates the namespace, metric, and dimension fields in the query editor.&lt;/td&gt;
              &lt;td&gt;Required for metrics queries and metrics template variables.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloudwatch:GetMetricData&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Retrieves metric data points for queries and metric math expressions.&lt;/td&gt;
              &lt;td&gt;Required for metrics queries.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloudwatch:GetInsightRuleReport&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Retrieves data from CloudWatch Contributor Insights rules.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed if you query Contributor Insights rules.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloudwatch:DescribeAlarms&lt;/code&gt;, &lt;code&gt;cloudwatch:DescribeAlarmsForMetric&lt;/code&gt;, &lt;code&gt;cloudwatch:DescribeAlarmHistory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Reads CloudWatch alarm configuration and history.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed if you display alarm data.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;pi:GetResourceMetrics&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Retrieves Performance Insights metrics for supported resources, such as RDS databases.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed if you query Performance Insights metrics.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;logs:DescribeLogGroups&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Lists log groups and populates the log group selector.&lt;/td&gt;
              &lt;td&gt;Required for logs queries and the Log Groups template variable.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;logs:StartQuery&lt;/code&gt;, &lt;code&gt;logs:StopQuery&lt;/code&gt;, &lt;code&gt;logs:GetQueryResults&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Runs CloudWatch Logs Insights queries and retrieves their results.&lt;/td&gt;
              &lt;td&gt;Required for logs queries.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;logs:GetLogGroupFields&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Retrieves the fields available in a log group for autocomplete.&lt;/td&gt;
              &lt;td&gt;Optional. Improves the logs query editor experience.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;logs:GetLogEvents&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Retrieves individual log events.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed for queries that read raw log events.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;logs:Unmask&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Reveals data masked by a CloudWatch Logs data protection policy.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed to view masked sensitive data.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ec2:DescribeRegions&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Lists available AWS regions.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed if you rely on dynamic region discovery.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ec2:DescribeInstances&lt;/code&gt;, &lt;code&gt;ec2:DescribeTags&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Resolves EC2 instance attributes and tags for dimension and EC2 template variables.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed for EC2 Instance Attributes template variables.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ec2:DescribeVolumes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Resolves EBS volume IDs for the EBS Volume IDs template variable.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed for EBS Volume IDs template variables.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;tag:GetResources&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Resolves resource ARNs for the Resource ARNs template variable.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed for Resource ARNs template variables.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;oam:ListSinks&lt;/code&gt;, &lt;code&gt;oam:ListAttachedLinks&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Discovers linked accounts for CloudWatch cross-account observability.&lt;/td&gt;
              &lt;td&gt;Optional. Only needed for cross-account observability.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When you use an &lt;strong&gt;Assume Role ARN&lt;/strong&gt;, attach these query permissions to the assumed role. The primary credentials only need permission to perform &lt;code&gt;sts:AssumeRole&lt;/code&gt;. For details, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/#assume-a-role&#34;&gt;Assume a role&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;cloudwatch-logs-data-protection&#34;&gt;CloudWatch Logs data protection&lt;/h3&gt;
&lt;p&gt;CloudWatch Logs can protect data by applying log group data protection policies. When data protection is enabled for a log group, any sensitive data that matches the identifiers you select is automatically masked. To view masked data, your IAM role or user must have the &lt;code&gt;logs:Unmask&lt;/code&gt; permission. For more details, refer to &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;the AWS guide&lt;/a&gt; on masking sensitive log data.&lt;/p&gt;
&lt;h3 id=&#34;configure-the-data-source-with-grafanaini&#34;&gt;Configure the data source with grafana.ini&lt;/h3&gt;
&lt;p&gt;The Grafana 
    &lt;a href=&#34;/docs/grafana/v13.2/setup-grafana/configure-grafana/#aws&#34;&gt;configuration file&lt;/a&gt; includes an &lt;code&gt;AWS&lt;/code&gt; section where you can configure data source options:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Configuration option&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;allowed_auth_providers&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Specifies which authentication providers are allowed for the CloudWatch data source as a comma-separated list. The default is &lt;code&gt;default,keys,credentials&lt;/code&gt;: &lt;code&gt;default&lt;/code&gt; (AWS SDK Default), &lt;code&gt;keys&lt;/code&gt; (Access and secret key), and &lt;code&gt;credentials&lt;/code&gt; (Credentials file). The &lt;code&gt;ec2_iam_role&lt;/code&gt; (EC2 IAM role) provider is also available but isn&amp;rsquo;t enabled by default.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;assume_role_enabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Allows you to disable &lt;code&gt;assume role (ARN)&lt;/code&gt; in the CloudWatch data source. The assume role (ARN) is enabled by default in open source Grafana.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;per_datasource_http_proxy_enabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Allows each CloudWatch data source instance to use its own HTTP proxy configuration for requests to AWS, instead of a shared proxy. Disabled by default. Set to &lt;code&gt;true&lt;/code&gt; to enable.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;list_metrics_page_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the limit of List Metrics API pages. When a custom namespace is specified in the query editor, the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;List Metrics API&lt;/a&gt; populates the &lt;em&gt;Metrics&lt;/em&gt; field and &lt;em&gt;Dimension&lt;/em&gt; fields. The API is paginated and returns up to 500 results per page, and the data source also limits the number of pages to 500 by default. This setting customizes that limit.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;provision-the-data-source&#34;&gt;Provision the data source&lt;/h3&gt;
&lt;p&gt;You can define and configure the data source in YAML files as part of the Grafana provisioning system.
For more information about provisioning and available configuration options, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/administration/provisioning/#data-sources&#34;&gt;Provision Grafana&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Using AWS SDK (default)&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: 1
datasources:
  - name: CloudWatch
    type: CloudWatch
    jsonData:
      authType: default
      defaultRegion: eu-west-2&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Using credentials&amp;rsquo; profile name (non-default)&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: 1

datasources:
  - name: CloudWatch
    type: CloudWatch
    jsonData:
      authType: credentials
      defaultRegion: eu-west-2
      customMetricsNamespaces: &amp;#39;CWAgent,CustomNameSpace&amp;#39;
      profile: secondary&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Using &lt;code&gt;accessKey&lt;/code&gt; and &lt;code&gt;secretKey&lt;/code&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: 1

datasources:
  - name: CloudWatch
    type: CloudWatch
    jsonData:
      authType: keys
      defaultRegion: eu-west-2
    secureJsonData:
      accessKey: &amp;#39;&amp;lt;your access key&amp;gt;&amp;#39;
      secretKey: &amp;#39;&amp;lt;your secret key&amp;gt;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Using AWS SDK Default and ARN of IAM Role to Assume:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: 1
datasources:
  - name: CloudWatch
    type: CloudWatch
    jsonData:
      authType: default
      assumeRoleArn: arn:aws:iam::123456789012:root
      defaultRegion: eu-west-2&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;configure-with-terraform&#34;&gt;Configure with Terraform&lt;/h3&gt;
&lt;p&gt;You can configure the CloudWatch data source using &lt;a href=&#34;https://www.terraform.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Terraform&lt;/a&gt; with the &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Terraform provider&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For more information about provisioning resources with Terraform, refer to &lt;a href=&#34;/docs/grafana-cloud/developer-resources/infrastructure-as-code/terraform/&#34;&gt;Grafana as code using Terraform&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The following example uses the &lt;strong&gt;Access and secret key&lt;/strong&gt; authentication method:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_data_source&amp;#34; &amp;#34;cloudwatch&amp;#34; {
  name = &amp;#34;CloudWatch&amp;#34;
  type = &amp;#34;cloudwatch&amp;#34;

  json_data_encoded = jsonencode({
    authType      = &amp;#34;keys&amp;#34;
    defaultRegion = &amp;#34;eu-west-2&amp;#34;
  })

  secure_json_data_encoded = jsonencode({
    accessKey = &amp;#34;&amp;lt;YOUR_ACCESS_KEY&amp;gt;&amp;#34;
    secretKey = &amp;#34;&amp;lt;YOUR_SECRET_KEY&amp;gt;&amp;#34;
  })
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following example uses the &lt;strong&gt;AWS SDK Default&lt;/strong&gt; authentication method with an assumed role:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_data_source&amp;#34; &amp;#34;cloudwatch&amp;#34; {
  name = &amp;#34;CloudWatch&amp;#34;
  type = &amp;#34;cloudwatch&amp;#34;

  json_data_encoded = jsonencode({
    authType      = &amp;#34;default&amp;#34;
    assumeRoleArn = &amp;#34;arn:aws:iam::123456789012:role/&amp;lt;ROLE_NAME&amp;gt;&amp;#34;
    defaultRegion = &amp;#34;eu-west-2&amp;#34;
  })
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the placeholders with your own values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;YOUR_ACCESS_KEY&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;YOUR_SECRET_KEY&amp;gt;&lt;/code&gt;: The AWS access key ID and secret access key for the &lt;strong&gt;Access and secret key&lt;/strong&gt; method.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;ROLE_NAME&amp;gt;&lt;/code&gt;: The name of the IAM role to assume.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For all available configuration options, refer to the &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs/resources/data_source&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana provider data source resource documentation&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="configure-the-amazon-cloudwatch-data-source">Configure the Amazon CloudWatch data source&lt;/h1>
&lt;p>This document provides instructions for configuring the Amazon CloudWatch data source and explains available configuration options. For general information on adding and managing data sources, refer to
&lt;a href="/docs/grafana/v13.2/administration/data-source-management/">Data source management&lt;/a>.&lt;/p></description></item><item><title>Configure AWS authentication</title><link>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/</link><pubDate>Tue, 18 Aug 2026 10:15:08 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/</guid><content><![CDATA[&lt;h1 id=&#34;configure-aws-authentication&#34;&gt;Configure AWS authentication&lt;/h1&gt;
&lt;p&gt;Grafana data source plugins make requests to AWS on behalf of an AWS Identity and Access Management (IAM) &lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;role&lt;/a&gt; or IAM &lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;user&lt;/a&gt;.
The IAM user or IAM role must have the associated policies to perform certain API actions for querying data source data.
Since these policies are specific to each data source, refer to individual data source plugin documentation for details.&lt;/p&gt;
&lt;p&gt;The Grafana backend performs all AWS API requests server-side using the official &lt;a href=&#34;https://github.com/aws/aws-sdk-go&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS SDK&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This document explores the following topics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#select-an-authentication-method&#34;&gt;Select an authentication method&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#assume-a-role&#34;&gt;Assume a role&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#use-a-custom-endpoint&#34;&gt;Use a custom endpoint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#use-an-aws-credentials-file&#34;&gt;Use an AWS credentials file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#use-eks-iam-roles-for-service-accounts&#34;&gt;Use EKS IAM roles for service accounts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;select-an-authentication-method&#34;&gt;Select an authentication method&lt;/h2&gt;
&lt;p&gt;Available authentication methods depend on your configuration and the environment where Grafana runs.&lt;/p&gt;
&lt;p&gt;Open source Grafana enables the &lt;code&gt;AWS SDK Default&lt;/code&gt;, &lt;code&gt;Credentials file&lt;/code&gt;, and &lt;code&gt;Access &amp;amp; secret key&lt;/code&gt; methods by default. Cloud Grafana enables &lt;code&gt;Access &amp;amp; secret key&lt;/code&gt; and &lt;code&gt;Grafana Assume Role&lt;/code&gt; by default. Users with server configuration access can enable or disable specific auth providers as needed. For more information, refer to the 
    &lt;a href=&#34;/docs/grafana/v13.2/setup-grafana/configure-grafana/#allowed_auth_providers&#34;&gt;&lt;code&gt;allowed_auth_providers&lt;/code&gt; documentation&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AWS SDK Default&lt;/code&gt; uses the &lt;a href=&#34;https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;default provider&lt;/a&gt; from the &lt;a href=&#34;https://github.com/aws/aws-sdk-go&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS SDK for Go&lt;/a&gt; without custom configuration.
This method requires configuring AWS credentials outside Grafana through &lt;a href=&#34;https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;the CLI&lt;/a&gt;, or by &lt;a href=&#34;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;attaching credentials directly to an EC2 instance&lt;/a&gt;, &lt;a href=&#34;https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;in an ECS task&lt;/a&gt;, or for a &lt;a href=&#34;https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Service Account in a Kubernetes cluster&lt;/a&gt;. You can attach permissions directly to the data source with AWS SDK Default or combine it with the optional &lt;a href=&#34;#assume-a-role&#34;&gt;&lt;code&gt;Assume Role ARN&lt;/code&gt;&lt;/a&gt; field.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Credentials file&lt;/code&gt; maps to the &lt;a href=&#34;https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials/#SharedCredentialsProvider&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;SharedCredentialsProvider&lt;/a&gt; provider in the &lt;a href=&#34;https://github.com/aws/aws-sdk-go&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS SDK for Go&lt;/a&gt;.
This method reads the AWS shared credentials file for a specified profile.
Unlike &lt;code&gt;AWS SDK Default&lt;/code&gt; which also reads the shared credentials file, this option lets you specify a profile directly without environment variables.
This option provides no fallback to other credential providers and fails if the file credentials are invalid.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Access &amp;amp; secret key&lt;/code&gt; corresponds to the &lt;a href=&#34;https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials/#StaticProvider&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;StaticProvider&lt;/a&gt; and authenticates using a specified access key ID and secret key pair.
This method doesn&amp;rsquo;t provide fallback authentication and fails if the key pair is invalid. It&amp;rsquo;s available in Grafana Cloud, though &lt;code&gt;Grafana Assume Role&lt;/code&gt; is recommended there because it avoids managing long-term access keys.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Grafana Assume Role&lt;/code&gt; - With this authentication method, Grafana Cloud users create an AWS IAM role that has a trust relationship with the Grafana AWS account. Grafana uses &lt;a href=&#34;https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;STS&lt;/a&gt; to generate temporary credentials on its behalf. This method eliminates the need to generate secret and access keys for users. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/#use-grafana-assume-role&#34;&gt;Use Grafana Assume Role&lt;/a&gt; for more information.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Workspace IAM Role&lt;/code&gt; corresponds to the &lt;a href=&#34;https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials/ec2rolecreds/#EC2RoleProvider&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;EC2RoleProvider&lt;/a&gt;.
The EC2RoleProvider retrieves credentials from a role attached to the EC2 instance running Grafana.
While AWS SDK Default can achieve similar results, this option provides no fallback authentication. Amazon Managed Grafana enables this option by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;assume-a-role&#34;&gt;Assume a role&lt;/h2&gt;
&lt;p&gt;Specify an IAM role to assume in the &lt;strong&gt;Assume Role ARN&lt;/strong&gt; field.&lt;/p&gt;
&lt;p&gt;When you configure &lt;strong&gt;Assume Role ARN&lt;/strong&gt;, Grafana uses the provided credentials to perform an &lt;a href=&#34;https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;sts:AssumeRole&lt;/a&gt; call. The primary authentication method only needs permission to assume the role, while the assumed role requires CloudWatch access permissions.&lt;/p&gt;
&lt;p&gt;For example, you might use one set of long-term credentials across all AWS data sources but want to limit each data source&amp;rsquo;s AWS access (such as separating staging and production data access). You could create separate credentials for each data source with distinct permissions, but this approach requires managing and rotating multiple secret and access keys across many data source instances.&lt;/p&gt;
&lt;p&gt;Instead, assume role functionality lets you use one set of AWS credentials across all AWS data sources with a single permission: the ability to assume roles through STS. You then create separate IAM roles for each data source that specify temporary permissions. Since IAM roles are not credentials, they require no rotation and simplify management.&lt;/p&gt;
&lt;p&gt;If the &lt;strong&gt;Assume Role ARN&lt;/strong&gt; field is left empty, Grafana uses the provided credentials from the selected authentication method directly, and permissions to AWS data must be attached directly to those credentials. The &lt;strong&gt;Assume Role ARN&lt;/strong&gt; field is optional for all authentication methods except for Grafana Assume Role.&lt;/p&gt;
&lt;p&gt;To disable this feature in open source Grafana or Grafana Enterprise, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/setup-grafana/configure-grafana/#assume_role_enabled&#34;&gt;&lt;code&gt;assume_role_enabled&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;use-an-external-id&#34;&gt;Use an external ID&lt;/h3&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;You cannot use an external ID for the Grafana Assume Role authentication provider.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To assume a role in another account created with an external ID, specify the external ID in the &lt;strong&gt;External ID&lt;/strong&gt; field.&lt;/p&gt;
&lt;p&gt;For more information, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS documentation on external ID&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-a-custom-endpoint&#34;&gt;Use a custom endpoint&lt;/h2&gt;
&lt;p&gt;Use the &lt;strong&gt;Endpoint&lt;/strong&gt; field to specify a custom endpoint URL that overrides the default AWS service API endpoint. Leave this field blank to use the default generated endpoint.&lt;/p&gt;
&lt;p&gt;For more information about using service endpoints, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/general/latest/gr/rande.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS service endpoints documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-an-aws-credentials-file&#34;&gt;Use an AWS credentials file&lt;/h2&gt;
&lt;p&gt;Create a file at &lt;code&gt;~/.aws/credentials&lt;/code&gt;, the &lt;code&gt;HOME&lt;/code&gt; path for the user running the &lt;code&gt;grafana-server&lt;/code&gt; service.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;If the credentials file appears to be in the correct location but isn&amp;rsquo;t working, move your &lt;code&gt;aws&lt;/code&gt; file to &lt;code&gt;/usr/share/grafana/&lt;/code&gt; and set the credentials file permissions to &lt;code&gt;0644&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Credentials file example:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;[default]
aws_access_key_id = asdsadasdasdasd
aws_secret_access_key = dasdasdsadasdasdasdsa
region = us-west-2&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;use-eks-iam-roles-for-service-accounts&#34;&gt;Use EKS IAM roles for service accounts&lt;/h2&gt;
&lt;p&gt;EKS IAM roles for service accounts (IRSA) are an AWS EKS feature that allows pods to assume IAM roles without storing long-term credentials. When you configure IRSA in your EKS cluster, AWS injects temporary credentials into your pod as projected volume mounts.&lt;/p&gt;
&lt;p&gt;In Grafana containers, the process runs as user &lt;code&gt;472&lt;/code&gt; (&lt;code&gt;grafana&lt;/code&gt;).
By default, Kubernetes mounts the projected credentials with permissions for the root user only.&lt;/p&gt;
&lt;p&gt;To grant user &lt;code&gt;472&lt;/code&gt; permission to access the credentials, and prevent fallback to the IAM role attached to the EC2 instance, set a &lt;a href=&#34;https://kubernetes.io/docs/tasks/configure-pod-container/security-context/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;security context&lt;/a&gt; for your pod.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Security context example:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;securityContext:
  fsGroup: 472
  runAsUser: 472
  runAsGroup: 472&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;use-grafana-assume-role&#34;&gt;Use Grafana Assume Role&lt;/h2&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Grafana Assume Role is available only in Grafana Cloud. It&amp;rsquo;s currently supported only for the Amazon CloudWatch and Amazon Athena data sources.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The Grafana Assume Role authentication provider lets you access AWS without creating or managing long-term AWS IAM users or rotating access keys. Instead, you can create an IAM role that has permissions to access CloudWatch and trusts a Grafana AWS account.&lt;/p&gt;
&lt;p&gt;The Grafana AWS account then makes a Security Token Service (STS) request to generate temporary credentials for your AWS data. This request includes an &lt;code&gt;externalID&lt;/code&gt; unique to your Grafana Cloud account, which ensures users can access only their own AWS resources.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The trust policy names the shared Grafana AWS account as the trusted principal, but this doesn&amp;rsquo;t grant every Grafana customer access to your role. The &lt;code&gt;sts:ExternalId&lt;/code&gt; condition restricts the trust to your unique external ID, so AWS only allows an assume-role request that presents that exact value. Grafana sends your external ID only for your own data source requests. The external ID isn&amp;rsquo;t a secret, but combined with the account-level trust it ensures one customer can&amp;rsquo;t assume another customer&amp;rsquo;s role. Keep the &lt;code&gt;sts:ExternalId&lt;/code&gt; condition in the trust policy — removing it would let any account that Grafana trusts assume your role.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;For more information, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS documentation on external ID&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To use the Grafana Assume Role:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new CloudWatch data source (or update an existing one) and select &lt;strong&gt;Grafana Assume Role&lt;/strong&gt; as an authentication provider.&lt;/li&gt;
&lt;li&gt;In the AWS Console, create a new IAM role, and under &lt;strong&gt;Trusted entity type&lt;/strong&gt;, select &lt;strong&gt;Another AWS account&lt;/strong&gt; as the trusted Entity.&lt;/li&gt;
&lt;li&gt;Enter the Grafana account id (displayed in the instructions box on the &lt;strong&gt;Settings&lt;/strong&gt; tab of the CloudWatch data source configuration) and check the &lt;strong&gt;Require external ID&lt;/strong&gt; box.&lt;/li&gt;
&lt;li&gt;Enter the external ID specified in the instructions box on the &lt;strong&gt;Settings&lt;/strong&gt; tab of the CloudWatch data source configuration in Grafana. This external ID will be unique to your Grafana instance.&lt;/li&gt;
&lt;li&gt;Attach any required permissions you would like Grafana to be able to access on your behalf (for example, CloudWatch Logs and CloudWatch Metrics policies).&lt;/li&gt;
&lt;li&gt;Give the role a name and description, and click &lt;strong&gt;Create role&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Copy the ARN of the role you just created and paste it into the &lt;strong&gt;Assume Role ARN&lt;/strong&gt; field on the &lt;strong&gt;Settings&lt;/strong&gt; tab of CloudWatch data source configuration in Grafana.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Sample Trust Relationship for an IAM role:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;{
    &amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
    &amp;#34;Statement&amp;#34;: [
        {
            &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
            &amp;#34;Principal&amp;#34;: {
                &amp;#34;AWS&amp;#34;: {Grafana&amp;#39;s AWS Account}
            },
            &amp;#34;Action&amp;#34;: &amp;#34;sts:AssumeRole&amp;#34;,
            &amp;#34;Condition&amp;#34;: {
                &amp;#34;StringEquals&amp;#34;: {
                    &amp;#34;sts:ExternalId&amp;#34;: {External ID unique to your account}
                }
            }
        }
    ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="configure-aws-authentication">Configure AWS authentication&lt;/h1>
&lt;p>Grafana data source plugins make requests to AWS on behalf of an AWS Identity and Access Management (IAM) &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html" target="_blank" rel="noopener noreferrer">role&lt;/a> or IAM &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html" target="_blank" rel="noopener noreferrer">user&lt;/a>.
The IAM user or IAM role must have the associated policies to perform certain API actions for querying data source data.
Since these policies are specific to each data source, refer to individual data source plugin documentation for details.&lt;/p></description></item><item><title>Amazon CloudWatch query editor</title><link>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/query-editor/</link><pubDate>Tue, 18 Aug 2026 10:15:08 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/query-editor/</guid><content><![CDATA[&lt;h1 id=&#34;amazon-cloudwatch-query-editor&#34;&gt;Amazon CloudWatch query editor&lt;/h1&gt;
&lt;p&gt;Grafana provides a query editor for the CloudWatch data source, which allows you to query, visualize, and alert on logs and metrics stored in Amazon CloudWatch. It is located on the 
    &lt;a href=&#34;/docs/grafana/v13.2/explore/&#34;&gt;Explore&lt;/a&gt; page. For general documentation on querying data sources in Grafana, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/panels-visualizations/query-transform-data/&#34;&gt;Query and transform data&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;key-concepts&#34;&gt;Key concepts&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re new to CloudWatch, these terms are used throughout this documentation:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Term&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Namespace&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A container for CloudWatch metrics, usually one per AWS service, such as &lt;code&gt;AWS/EC2&lt;/code&gt; or &lt;code&gt;AWS/Lambda&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Metric&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A time-ordered set of data points published to CloudWatch, such as &lt;code&gt;CPUUtilization&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Dimension&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A name-value pair that identifies a specific resource for a metric, such as &lt;code&gt;InstanceId=i-1234567890abcdef0&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Statistic&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An aggregation applied to metric data over a period, such as &lt;code&gt;Average&lt;/code&gt;, &lt;code&gt;Sum&lt;/code&gt;, or &lt;code&gt;Maximum&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Period&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The length of time, in seconds, used to aggregate metric data points.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Metric math&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Expressions that combine or transform metrics, such as computing a rate or a sum across metrics.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Metrics Insights&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A SQL-like query engine for filtering and aggregating metrics in near real time.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Search expression&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A CloudWatch expression that matches multiple metrics at query time, often used with wildcards.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Logs Insights QL&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The CloudWatch Logs query language used to search and aggregate log data.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;choose-a-query-editing-mode&#34;&gt;Choose a query editing mode&lt;/h2&gt;
&lt;p&gt;The CloudWatch data source can query data from both CloudWatch metrics and CloudWatch Logs APIs, each with its own specialized query editor.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#query-cloudwatch-metrics&#34;&gt;CloudWatch Metrics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#query-cloudwatch-logs&#34;&gt;CloudWatch Logs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Select the API to query using the drop-down to the right of the &lt;strong&gt;Region&lt;/strong&gt; setting.&lt;/p&gt;
&lt;h2 id=&#34;cloudwatch-metrics-query-editor-components&#34;&gt;CloudWatch Metrics query editor components&lt;/h2&gt;
&lt;p&gt;The following are the components of the CloudWatch query editor.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;&lt;strong&gt;Setting&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Region&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Select an AWS region if it differs from the default.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Namespace&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The AWS service namespace. Examples: &lt;code&gt;AWS/EC2&lt;/code&gt;, &lt;code&gt;AWS/Lambda&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Metric name&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The name of the metric you want to visualize. Example: &lt;code&gt;CPUUtilization&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Statistic&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Choose how to aggregate your data. Options are &lt;code&gt;Average&lt;/code&gt;, &lt;code&gt;Maximum&lt;/code&gt;, &lt;code&gt;Minimum&lt;/code&gt;, &lt;code&gt;Sum&lt;/code&gt;, &lt;code&gt;SampleCount&lt;/code&gt;, and &lt;code&gt;IQM&lt;/code&gt;. You can also enter a custom value, such as a percentile like &lt;code&gt;p99&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Dimensions&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Select dimensions from the drop-down. Examples: &lt;code&gt;InstanceId&lt;/code&gt;, &lt;code&gt;FunctionName&lt;/code&gt;, &lt;code&gt;latency&lt;/code&gt;. You can add several dimensions to your query.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Match exact&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Optional&lt;/em&gt;. When enabled, this option restricts query results to metrics that precisely match the specified dimensions and their values. All dimensions of the queried metric must be explicitly defined in the query to ensure an exact schema match. If disabled, the query will also return metrics that match the defined schema but possess additional dimensions.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;ID&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Optional&lt;/em&gt;. Unique identifier required by the GetMetricData API for referencing queries in math expressions. Must start with a lowercase letter and can include letters, numbers, and underscores. If not specified, Grafana generates an ID using the pattern &lt;code&gt;query[refId]&lt;/code&gt; (for example, &lt;code&gt;queryA&lt;/code&gt;for the first query row).&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Period&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The minimum time interval, in seconds, between data points. The default is &lt;code&gt;auto&lt;/code&gt;. CloudWatch accepts periods of 1, 5, 10, 30, or any multiple of 60 seconds. When set to &lt;code&gt;auto&lt;/code&gt; or left blank, Grafana calculates the period by dividing the time range in seconds by 2000, then rounding up to the next value among 60, 300, 900, 3600, 21600, and 86400. The available periods depend on the age of the data: because CloudWatch stores older metrics at a lower resolution under its &lt;a href=&#34;https://aws.amazon.com/about-aws/whats-new/2016/11/cloudwatch-extends-metrics-retention-and-new-user-interface/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;retention policy&lt;/a&gt;, the shorter periods aren&amp;rsquo;t available for older time ranges.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Label&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Optional&lt;/em&gt;. Add a customized time series legend name. The label field overrides the default metric legend name using CloudWatch dynamic labels. Time-based dynamic labels like ${MIN_MAX_TIME_RANGE} derive legend values from the current timezone in the time range picker. For the full list of label patterns and limitations, refer to &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch dynamic labels&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;use-builder-and-code-modes&#34;&gt;Use Builder and Code modes&lt;/h2&gt;
&lt;p&gt;Both the Metric Search and Metric Insights query types provide two editing modes. Use the &lt;strong&gt;Builder&lt;/strong&gt; and &lt;strong&gt;Code&lt;/strong&gt; toggle in the query editor to switch between them.&lt;/p&gt;
&lt;h3 id=&#34;builder-mode&#34;&gt;Builder mode&lt;/h3&gt;
&lt;p&gt;Builder mode lets you construct a query from drop-downs and form fields without writing any syntax:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;strong&gt;Metric Search&lt;/strong&gt; queries, select the namespace, metric name, statistic, and dimensions.&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;Metric Insights&lt;/strong&gt; queries, select the namespace, metric name, filter, group, and order options using the &lt;a href=&#34;#use-metrics-insights-keywords&#34;&gt;Metrics Insights keywords&lt;/a&gt;. Grafana constructs a SQL query based on your selections.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;code-mode&#34;&gt;Code mode&lt;/h3&gt;
&lt;p&gt;Code mode lets you write your query directly in a code editor:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;strong&gt;Metric Search&lt;/strong&gt; queries, write a metric math or &lt;code&gt;SEARCH&lt;/code&gt; expression.&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;Metric Insights&lt;/strong&gt; queries, write a Metrics Insights SQL query.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The code editor includes a built-in autocomplete feature that suggests keywords, aggregations, namespaces, metrics, labels, and label values.
Suggestions appear after typing a space, comma, or dollar (&lt;code&gt;$&lt;/code&gt;) character, or by pressing &lt;key&gt;CTRL&lt;/key&gt;&#43;&lt;key&gt;Space&lt;/key&gt;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Template variables in the code editor can interfere with autocompletion.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To run the query, click &lt;strong&gt;Run query&lt;/strong&gt; above the code editor.&lt;/p&gt;
&lt;h2 id=&#34;query-cloudwatch-metrics&#34;&gt;Query CloudWatch metrics&lt;/h2&gt;
&lt;p&gt;You can create two types of queries in the CloudWatch query editor:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#metric-search-queries&#34;&gt;Metric Search&lt;/a&gt;, which helps you retrieve and filter available metrics.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#use-metric-insights-syntax&#34;&gt;Metric Insights&lt;/a&gt;, which uses the Metrics Insights feature to fetch time series data.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The query type you use depends on how you want to interact with AWS metrics. Use the drop-down in the upper middle of the query editor to select which type you want to create.&lt;/p&gt;
&lt;h3 id=&#34;metric-search-queries&#34;&gt;Metric Search queries&lt;/h3&gt;
&lt;p&gt;Metric search queries help you discover and filter available metrics. These queries use wildcards and filters to find metrics without needing to know exact metric names.&lt;/p&gt;
&lt;p&gt;A valid metric query requires a specified namespace, metric name, and at least one statistic. Dimensions are optional, but if included, you must provide both a &lt;code&gt;key&lt;/code&gt; and a &lt;code&gt;value&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;Match Exact&lt;/code&gt; option controls how dimension filtering is applied to metric queries. When you enable &lt;code&gt;match exact&lt;/code&gt;, the query returns only metrics whose dimensions precisely match the specified criteria.&lt;/p&gt;
&lt;p&gt;This requires the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All dimensions present on the target metric must be explicitly specified.&lt;/li&gt;
&lt;li&gt;Dimensions you don&amp;rsquo;t want to filter by must use a wildcard (*) filter.&lt;/li&gt;
&lt;li&gt;The metric schema must match exactly as defined in the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/search-expression-syntax.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch metric schema&lt;/a&gt; documentation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When &lt;code&gt;Match Exact&lt;/code&gt; is disabled, you can specify any subset of dimensions for filtering. The query returns metrics that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Match the specified namespace and metric name.&lt;/li&gt;
&lt;li&gt;Match all defined dimension filters.&lt;/li&gt;
&lt;li&gt;May contain additional dimensions beyond those specified.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This mode provides more flexible querying but may return metrics with unexpected additional dimensions.&lt;/p&gt;
&lt;p&gt;Because the data source retrieves metrics through the CloudWatch &lt;code&gt;GetMetricData&lt;/code&gt; API, a single query returns data for up to 100 metrics matching your filter criteria, which is the per-request limit that AWS enforces.&lt;/p&gt;
&lt;p&gt;Enhance metric queries using template variables to create dynamic, reusable dashboards.&lt;/p&gt;
&lt;h4 id=&#34;create-dynamic-queries-with-dimension-wildcards&#34;&gt;Create dynamic queries with dimension wildcards&lt;/h4&gt;
&lt;p&gt;Use the asterisk (&lt;code&gt;*&lt;/code&gt;) wildcard for dimension values to create dynamic queries that automatically monitor changing sets of AWS resources.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 500px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link captioned&#34;
        href=&#34;/static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload mb-0&#34;
          data-src=&#34;/static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png&#34;data-srcset=&#34;/static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png?w=320 320w, /static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png?w=550 550w, /static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png?w=750 750w, /static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png?w=900 900w, /static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png?w=1040 1040w, /static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png?w=1240 1240w, /static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;CloudWatch dimension wildcard&#34;width=&#34;788&#34;height=&#34;375&#34;title=&#34;CloudWatch dimension wildcard&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/cloudwatch/cloudwatch-dimension-wildcard-8.3.0.png&#34;
            alt=&#34;CloudWatch dimension wildcard&#34;width=&#34;788&#34;height=&#34;375&#34;title=&#34;CloudWatch dimension wildcard&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;CloudWatch dimension wildcard&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;The query returns the average CPU utilization for all EC2 instances in the default region. With &lt;code&gt;Match Exact&lt;/code&gt; disabled and &lt;code&gt;InstanceId&lt;/code&gt; using a wildcard, the query retrieves metrics for any EC2 instance regardless of additional dimensions.&lt;/p&gt;
&lt;p&gt;Auto-scaling events add new instances to the graph without manual instance ID tracking. As with other metric search queries, AWS returns up to 100 metrics per &lt;code&gt;GetMetricData&lt;/code&gt; request.&lt;/p&gt;
&lt;p&gt;Click the 
    &lt;a href=&#34;/docs/grafana/v13.2/panels-visualizations/query-transform-data/#navigate-the-query-editor&#34;&gt;&lt;strong&gt;Query inspector&lt;/strong&gt;&lt;/a&gt; button and select &lt;strong&gt;Meta Data&lt;/strong&gt; to see the search expression that&amp;rsquo;s automatically built to support wildcards.&lt;/p&gt;
&lt;p&gt;To learn more about search expressions, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/search-expression-syntax.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch documentation&lt;/a&gt;.
The search expression is defined by default in such a way that the queried metrics must match the defined dimension names exactly.
This means that in the example, the query returns only metrics with exactly one dimension containing the name &lt;code&gt;InstanceId&lt;/code&gt;.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p docs-image--right&#34;
    style=&#34;max-width: 500px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link captioned&#34;
        href=&#34;/static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload mb-0&#34;
          data-src=&#34;/static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png&#34;data-srcset=&#34;/static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png?w=320 320w, /static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png?w=550 550w, /static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png?w=750 750w, /static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png?w=900 900w, /static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png?w=1040 1040w, /static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png?w=1240 1240w, /static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;CloudWatch Meta Inspector&#34;width=&#34;928&#34;height=&#34;161&#34;title=&#34;CloudWatch Meta Inspector&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/cloudwatch/cloudwatch-meta-inspector-8.3.0.png&#34;
            alt=&#34;CloudWatch Meta Inspector&#34;width=&#34;928&#34;height=&#34;161&#34;title=&#34;CloudWatch Meta Inspector&#34;class=&#34;docs-image--right&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;CloudWatch Meta Inspector&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;Disabling &lt;code&gt;Match Exact&lt;/code&gt; includes metrics with additional dimensions and creates a search expression even without wildcards. Grafana searches for any metric matching at least the namespace, metric name, and all defined dimensions.&lt;/p&gt;
&lt;h4 id=&#34;use-multi-value-template-variables&#34;&gt;Use multi-value template variables&lt;/h4&gt;
&lt;p&gt;When defining dimension values based on multi-valued template variables, the data source uses a search expression to query for the matching metrics.
This enables the use of multiple template variables in one query, and also lets you use template variables for queries that have the &lt;code&gt;Match Exact&lt;/code&gt; option disabled.&lt;/p&gt;
&lt;p&gt;Search expressions are limited to 1,024 characters, so your query might fail if you have a long list of values.
We recommend using the asterisk (&lt;code&gt;*&lt;/code&gt;) wildcard instead of the &lt;code&gt;All&lt;/code&gt; option to query all metrics that have any value for a certain dimension name.&lt;/p&gt;
&lt;p&gt;Multi-valued template variables are supported only for dimension values.
Using multi-valued template variables for &lt;code&gt;Region&lt;/code&gt;, &lt;code&gt;Namespace&lt;/code&gt;, or &lt;code&gt;Metric Name&lt;/code&gt; is not supported.&lt;/p&gt;
&lt;h4 id=&#34;use-metric-math-expressions&#34;&gt;Use metric math expressions&lt;/h4&gt;
&lt;p&gt;Create new time series metrics using mathematical functions on CloudWatch metrics. This supports arithmetic operators, unary subtraction, and other functions. For available functions, refer to &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS Metric Math&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To apply arithmetic operations, assign a unique string ID to the raw metric, then reference this ID in the &lt;code&gt;Expression&lt;/code&gt; field of the new metric.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;If you use the expression field to reference another query, such as &lt;code&gt;queryA * 2&lt;/code&gt;, you can&amp;rsquo;t create an alert rule based on that query.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;query-metrics-across-aws-monitoring-accounts&#34;&gt;Query metrics across AWS monitoring accounts&lt;/h3&gt;
&lt;p&gt;When you select &lt;code&gt;Builder&lt;/code&gt; mode within the Metric search editor, a new Account field is displayed. Use the &lt;code&gt;Account&lt;/code&gt; field to specify which of the linked monitoring accounts to target for the given query. By default, the &lt;code&gt;All&lt;/code&gt; option is specified, which will target all linked accounts.&lt;/p&gt;
&lt;p&gt;While in &lt;code&gt;Code&lt;/code&gt; mode, you can specify any math expression. If the Monitoring account badge displays in the query editor header, all &lt;code&gt;SEARCH&lt;/code&gt; expressions entered in this field will be cross-account by default and can query metrics from linked accounts. Note that while queries run cross-account, the autocomplete feature currently doesn&amp;rsquo;t fetch cross-account resources, so you&amp;rsquo;ll need to manually specify resource names when writing cross-account queries.
You can limit the search to one or a set of accounts, as documented in the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;period-macro&#34;&gt;Period macro&lt;/h3&gt;
&lt;p&gt;If you use a CloudWatch &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/search-expression-syntax.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;SEARCH&lt;/code&gt;&lt;/a&gt; expression, consider using the &lt;code&gt;$__period_auto&lt;/code&gt; macro rather than specifying a period explicitly. The &lt;code&gt;$__period_auto&lt;/code&gt; macro will resolve to a &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch period&lt;/a&gt; that is suitable for the chosen time range.&lt;/p&gt;
&lt;h3 id=&#34;deep-link-grafana-panels-to-the-cloudwatch-console&#34;&gt;Deep-link Grafana panels to the CloudWatch console&lt;/h3&gt;
&lt;p&gt;Left-clicking a time series in the panel displays a context menu with a link to &lt;code&gt;View in CloudWatch console&lt;/code&gt;.
Clicking the link opens a new tab that takes you to the CloudWatch console and displays all metrics for that query.
If you&amp;rsquo;re not logged in to the CloudWatch console, the link forwards you to the login page.
The link provided is valid for any account but displays the expected metrics only if you&amp;rsquo;re logged in to the account that corresponds to the selected data source in Grafana.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 1980px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link captioned&#34;
        href=&#34;/media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload mb-0&#34;
          data-src=&#34;/media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png&#34;data-srcset=&#34;/media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png?w=320 320w, /media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png?w=550 550w, /media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png?w=750 750w, /media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png?w=900 900w, /media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png?w=1040 1040w, /media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png?w=1240 1240w, /media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;CloudWatch deep linking&#34;width=&#34;1980&#34;height=&#34;840&#34;title=&#34;CloudWatch deep linking&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/cloudwatch/cloudwatch-deep-link-v12.1.png&#34;
            alt=&#34;CloudWatch deep linking&#34;width=&#34;1980&#34;height=&#34;840&#34;title=&#34;CloudWatch deep linking&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;CloudWatch deep linking&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;This feature is not available for metrics based on &lt;a href=&#34;#use-metric-math-expressions&#34;&gt;metric math expressions&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;use-metric-insights-syntax&#34;&gt;Use Metric Insights syntax&lt;/h3&gt;
&lt;p&gt;Metric Insights uses a dialect of SQL and this query syntax:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT FUNCTION(MetricName)
FROM Namespace | SCHEMA(...)
[ WHERE labelKey OPERATOR labelValue [AND|...]]
[ GROUP BY labelKey [, ...]]
[ ORDER BY FUNCTION() [DESC | ASC] ]
[ LIMIT number]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For details about the Metrics Insights syntax, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/console/cloudwatch/metricsinsights-syntax&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS reference documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For information about Metrics Insights limits, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/console/cloudwatch/metricsinsights&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS feature documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can also augment queries by using 
    &lt;a href=&#34;/docs/grafana/v13.2/dashboards/variables/add-template-variables/&#34;&gt;template variables&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;use-metrics-insights-keywords&#34;&gt;Use Metrics Insights keywords&lt;/h3&gt;
&lt;p&gt;This table summarizes common Metrics Insights query keywords:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Keyword&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;FUNCTION&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Required. Specifies the aggregate function to use, and also specifies the name of the metric to be queried. Valid values are AVG, COUNT, MAX, MIN, and SUM.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MetricName&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Required. For example, &lt;code&gt;CPUUtilization&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;FROM&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Required. Specifies the metric&amp;rsquo;s source. You can specify either the metric namespace that contains the metric to be queried, or a SCHEMA table function. Namespace examples include &lt;code&gt;AWS/EC2&lt;/code&gt;, &lt;code&gt;AWS/Lambda&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;SCHEMA&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Optional. Narrows the query results to only the metrics that are an exact match, or to metrics that do not match.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;WHERE&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Optional. Filters the query results to only the metrics that match your specified expression. For example, &lt;code&gt;WHERE InstanceType != &#39;c3.4xlarge&#39;&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;GROUP BY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Optional. Groups the query results into multiple time series. For example, &lt;code&gt;GROUP BY ServiceName&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ORDER BY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Optional. Specifies the order in which time series are returned. Options are &lt;code&gt;ASC&lt;/code&gt;, &lt;code&gt;DESC&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;LIMIT&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Optional. Limits the number of time series returned.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;query-cloudwatch-logs&#34;&gt;Query CloudWatch Logs&lt;/h2&gt;
&lt;p&gt;The logs query editor helps you write CloudWatch Logs queries across a selected region and a set of log groups or Amazon CloudWatch Logs data sources.&lt;/p&gt;
&lt;p&gt;You can query CloudWatch Logs using three supported query language options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Logs Insights QL&lt;/strong&gt; - The AWS native query language specifically designed for CloudWatch Logs. It uses a SQL-like syntax with commands like &lt;code&gt;fields&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt;, &lt;code&gt;stats&lt;/code&gt;, and &lt;code&gt;sort&lt;/code&gt;. It&amp;rsquo;s optimized for the CloudWatch log structure and offers built-in functions for parsing timestamps, extracting fields from JSON logs, and performing aggregations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenSearch SQL&lt;/strong&gt; - OpenSearch SQL is a query language that uses a SQL-like syntax for querying data in OpenSearch. It supports standard SQL queries and is designed for users familiar with SQL.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenSearch PPL&lt;/strong&gt; - The OpenSearch query language is based on Elasticsearch&amp;rsquo;s query DSL (Domain Specific Language). It uses a pipe-based syntax similar to Unix command-line tools or the Splunk search language, and supports complex boolean logic, range queries, wildcard matching, and full-text search capabilities.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Create a CloudWatch Logs query:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select a region.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;CloudWatch Logs&lt;/strong&gt; from the query type drop-down.&lt;/li&gt;
&lt;li&gt;Use the Logs Mode selector to choose between Logs Insights and Log Anomalies queries.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Log Anomalies&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/LogsAnomalyDetection.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Anomaly detection&lt;/a&gt; uses machine-learning and pattern recognition to establish baselines of typical log content.&lt;br /&gt;
The Log Anomalies query editor fetches the list of anomalies detected in your CloudWatch service. In order to query log anomalies in the editor, a log anomaly detector must be created in the AWS CloudWatch console first.
The log trend cell shows the number of occurrences of the pattern over the selected query time range.
The table shows 50 log anomalies at a time. If you would like to narrow down the list, you can filter anomalies by their ARN and suppressed state.&lt;/p&gt;
&lt;p&gt;In addition to this, you can use the Logs Insights QL editor and the &lt;code&gt;anomaly&lt;/code&gt; command together with the &lt;code&gt;patterns&lt;/code&gt; command to define and display log anomalies in real time. See the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/LogsAnomalyDetection-Insights.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch Logs Insights&lt;/a&gt; documentation for more info.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Logs Insights&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Query language&lt;/strong&gt; drop-down is available only when &lt;strong&gt;Logs Mode&lt;/strong&gt; is set to Logs Insights.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select the query language you want to use in the &lt;strong&gt;Query language&lt;/strong&gt; drop-down.&lt;/li&gt;
&lt;li&gt;Specify the log groups, CloudWatch Logs data sources, or both that you want to query.&lt;/li&gt;
&lt;li&gt;Use the main input area to write your logs query. Amazon CloudWatch only supports a subset of OpenSearch SQL and PPL commands. To find out more about the syntax supported, consult &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData_Languages.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Amazon CloudWatch Logs documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;specify-log-groups-to-query&#34;&gt;Specify log groups to query&lt;/h3&gt;
&lt;p&gt;To target log groups in your query, use one of the following methods:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Log group name&lt;/strong&gt;: Select specific log groups. This is the default behavior. You can select up to 50 log groups.
Click &lt;strong&gt;Select log groups&lt;/strong&gt; to choose the target log groups for your query.
When the &lt;strong&gt;Monitoring account&lt;/strong&gt; badge appears in the query editor header, you can search and select log groups across multiple accounts.
Use the &lt;strong&gt;Accounts&lt;/strong&gt; filter to narrow results by account.
For large lists, use prefix search to narrow the selection. The selector loads log groups in pages, so you can scroll to load more results when many log groups are available.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Name prefix&lt;/strong&gt;: Select the &lt;strong&gt;Name prefix&lt;/strong&gt; query scope and provide up to five log group name prefixes. The query will run against log groups that have names that start with the specified prefixes. Each prefix must be at least three characters and must not include &lt;code&gt;*&lt;/code&gt;. This option is only available for &lt;strong&gt;Logs Insights QL&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;All log groups&lt;/strong&gt;: Select the &lt;strong&gt;All log groups&lt;/strong&gt; query scope. This queries all log groups in the selected region. This option is only available for &lt;strong&gt;Logs Insights QL&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can also apply optional filters when specifying log groups with the &lt;strong&gt;Name prefix&lt;/strong&gt; or &lt;strong&gt;All log groups&lt;/strong&gt; query scopes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Class&lt;/strong&gt;: Filter by &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch_Logs_Log_Classes.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;log group class&lt;/a&gt;. Choose &lt;strong&gt;Standard&lt;/strong&gt; or &lt;strong&gt;Infrequent Access&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Accounts&lt;/strong&gt;: Filter by AWS account. This option is only available when the &lt;strong&gt;Monitoring account&lt;/strong&gt; badge appears in the query editor header. You can select up to 20 accounts.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;specify-amazon-cloudwatch-logs-data-sources-to-query&#34;&gt;Specify Amazon CloudWatch Logs data sources to query&lt;/h3&gt;
&lt;p&gt;Amazon CloudWatch Logs data sources categorize logs by the service or application that generates them and by the type of log. They complement log groups and let you query logs without knowing individual log group names. For details about how Amazon CloudWatch categorizes logs, refer to &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/data-source-discovery-management.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Data source discovery and management&lt;/a&gt; in the AWS documentation.&lt;/p&gt;
&lt;p&gt;Before you use the data source selector, ensure that the IAM role or IAM user for the Grafana data source has the &lt;code&gt;logs:ListAggregateLogGroupSummaries&lt;/code&gt; permission. For the complete IAM policy examples, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/#iam-policy-examples&#34;&gt;IAM policy examples&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To query logs by CloudWatch Logs data source, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Select data sources&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Search for a data source name or type.&lt;/li&gt;
&lt;li&gt;Select up to 10 data sources.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Apply selection&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can combine CloudWatch Logs data source selections with specific log groups or with the &lt;strong&gt;Name prefix&lt;/strong&gt; and &lt;strong&gt;All log groups&lt;/strong&gt; query scopes. When the &lt;strong&gt;Monitoring account&lt;/strong&gt; badge appears, the selector includes data sources from the monitoring account and its linked source accounts.&lt;/p&gt;
&lt;p&gt;The CloudWatch data source automatically adds the selected CloudWatch Logs data sources to Logs Insights QL and OpenSearch PPL queries.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;When you use &lt;strong&gt;Logs Insights QL&lt;/strong&gt;, &lt;strong&gt;OpenSearch PPL&lt;/strong&gt;, or &lt;strong&gt;OpenSearch SQL&lt;/strong&gt;, you must specify a region and define the logs to query by selecting log groups, selecting CloudWatch Logs data sources, or choosing a supported log group query scope.&lt;/p&gt;
&lt;p&gt;In &lt;strong&gt;OpenSearch SQL&lt;/strong&gt;, you can specify log groups in multiple ways. For details, refer to the &lt;a href=&#34;#query-log-groups-with-opensearch-sql&#34;&gt;Query log groups and Amazon CloudWatch Logs data sources with OpenSearch SQL&lt;/a&gt; section.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Click &lt;strong&gt;View in CloudWatch console&lt;/strong&gt; to interactively view, search, and analyze your log data in the CloudWatch Logs Insights console. If you&amp;rsquo;re not logged in to the CloudWatch console, the link forwards you to the login page.&lt;/p&gt;
&lt;h3 id=&#34;query-log-groups-with-opensearch-sql&#34;&gt;Query log groups and Amazon CloudWatch Logs data sources with OpenSearch SQL&lt;/h3&gt;
&lt;p&gt;When querying log groups and Amazon CloudWatch Logs data sources with OpenSearch SQL, you can use the &lt;code&gt;$__source&lt;/code&gt; macro to automatically reference the log groups and CloudWatch Logs data sources selected in the query editor. This is the recommended approach as it allows you to manage both types of selection through the UI.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT window.start, COUNT(*) AS exceptionCount
FROM `$__source`
WHERE `@message` LIKE &amp;#39;%Exception%&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;$__source&lt;/code&gt; macro expands to the proper syntax for the log groups and CloudWatch Logs data sources you&amp;rsquo;ve selected in the UI.&lt;/p&gt;
&lt;p&gt;Alternatively, you can manually specify a single log group directly in the &lt;code&gt;FROM&lt;/code&gt; clause:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT window.start, COUNT(*) AS exceptionCount
FROM `log_group`
WHERE `@message` LIKE &amp;#39;%Exception%&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;When querying multiple log groups you &lt;strong&gt;must&lt;/strong&gt; use the &lt;code&gt;logGroups(logGroupIdentifier: [...])&lt;/code&gt; syntax:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT window.start, COUNT(*) AS exceptionCount
FROM `logGroups(logGroupIdentifier: [&amp;#39;LogGroup1&amp;#39;, &amp;#39;LogGroup2&amp;#39;])`
WHERE `@message` LIKE &amp;#39;%Exception%&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To reference log groups in a monitoring account, use ARNs instead of LogGroup names.&lt;/p&gt;
&lt;p&gt;You can also write queries returning time series data by using the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_Insights-Visualizing-Log-Data.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;stats&lt;/code&gt; command&lt;/a&gt;.
When making &lt;code&gt;stats&lt;/code&gt; queries in 
    &lt;a href=&#34;/docs/grafana/v13.2/explore/&#34;&gt;Explore&lt;/a&gt;, ensure you are in Metrics Explore mode.&lt;/p&gt;
&lt;h3 id=&#34;create-queries-for-alerting&#34;&gt;Create queries for alerting&lt;/h3&gt;
&lt;p&gt;Alerting requires queries that return numeric data, which CloudWatch Logs supports.
For example, you can enable alerts through the use of the &lt;code&gt;stats&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;The following is a valid query for alerting on messages that include the text &amp;ldquo;Exception&amp;rdquo;:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;filter @message like /Exception/
    | stats count(*) as exceptionCount by bin(1h)
    | sort exceptionCount desc&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;If you receive an error like &lt;code&gt;input data must be a wide series but got ...&lt;/code&gt; when trying to alert on a query, make sure that your query returns valid numeric data that can be output to a Time series panel.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;For more information on Grafana alerts, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/alerting/&#34;&gt;Alerting&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;common-use-cases&#34;&gt;Common use cases&lt;/h2&gt;
&lt;p&gt;The following scenarios show how to combine the query editor&amp;rsquo;s features to solve real monitoring problems.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Monitor an EC2 fleet:&lt;/strong&gt; Use a Metric Search query for &lt;code&gt;AWS/EC2&lt;/code&gt; &lt;code&gt;CPUUtilization&lt;/code&gt; with the &lt;code&gt;InstanceId&lt;/code&gt; dimension set to a wildcard (&lt;code&gt;*&lt;/code&gt;) and &lt;code&gt;Match Exact&lt;/code&gt; disabled. The graph automatically includes new instances as your fleet scales.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Track Lambda errors and invocations:&lt;/strong&gt; Query the &lt;code&gt;AWS/Lambda&lt;/code&gt; namespace for the &lt;code&gt;Errors&lt;/code&gt; and &lt;code&gt;Invocations&lt;/code&gt; metrics, then add a metric math expression such as &lt;code&gt;errors / invocations * 100&lt;/code&gt; to chart an error rate.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rank the busiest resources:&lt;/strong&gt; Use a Metrics Insights query with &lt;code&gt;ORDER BY&lt;/code&gt; and &lt;code&gt;LIMIT&lt;/code&gt; to return the top N resources by a metric, for example, the 10 EC2 instances with the highest average CPU utilization.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Investigate application errors:&lt;/strong&gt; Use a CloudWatch Logs query with &lt;code&gt;filter&lt;/code&gt; and &lt;code&gt;stats&lt;/code&gt; to count errors over time, then correlate the spikes with metric panels on the same dashboard.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alert on log error rates:&lt;/strong&gt; Build a Logs query that returns numeric data with the &lt;code&gt;stats&lt;/code&gt; command, then create an alert rule on the result. Refer to &lt;a href=&#34;#create-queries-for-alerting&#34;&gt;Create queries for alerting&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;cross-account-observability&#34;&gt;Cross-account observability&lt;/h2&gt;
&lt;p&gt;The CloudWatch plugin monitors and troubleshoots applications that span multiple accounts within a region. Cross-account observability enables seamless searching, visualization, and analysis of metrics and logs across account boundaries.&lt;/p&gt;
&lt;p&gt;To enable cross-account observability, complete the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Amazon CloudWatch documentation&lt;/a&gt; and follow the instructions for enabling cross-account observability.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/#cross-account-observability-permissions&#34;&gt;two API actions&lt;/a&gt; to the IAM policy attached to the role/user running the plugin.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Cross-account querying is available in the plugin through the &lt;strong&gt;Logs&lt;/strong&gt;, &lt;strong&gt;Metric search&lt;/strong&gt;, and &lt;strong&gt;Metric Insights&lt;/strong&gt; modes.
After you have configured it, you&amp;rsquo;ll see a &lt;strong&gt;Monitoring account&lt;/strong&gt; badge in the query editor header.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 1200px;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link captioned&#34;
        href=&#34;/static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload mb-0&#34;
          data-src=&#34;/static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png&#34;data-srcset=&#34;/static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png?w=320 320w, /static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png?w=550 550w, /static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png?w=750 750w, /static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png?w=900 900w, /static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png?w=1040 1040w, /static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png?w=1240 1240w, /static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Monitoring account badge&#34;width=&#34;929&#34;height=&#34;81&#34;title=&#34;Monitoring account badge&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png&#34;
            alt=&#34;Monitoring account badge&#34;width=&#34;929&#34;height=&#34;81&#34;title=&#34;Monitoring account badge&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;Monitoring account badge&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h2 id=&#34;query-caching&#34;&gt;Query caching&lt;/h2&gt;
&lt;p&gt;When you enable 
    &lt;a href=&#34;/docs/grafana/v13.2/administration/data-source-management/#query-and-resource-caching&#34;&gt;query and resource caching&lt;/a&gt;, Grafana temporarily stores the results of data source queries and resource requests. Query caching is available in CloudWatch Metrics in Grafana Cloud and Grafana Enterprise. It is not available in CloudWatch Logs Insights due to how query results are polled from AWS.&lt;/p&gt;
]]></content><description>&lt;h1 id="amazon-cloudwatch-query-editor">Amazon CloudWatch query editor&lt;/h1>
&lt;p>Grafana provides a query editor for the CloudWatch data source, which allows you to query, visualize, and alert on logs and metrics stored in Amazon CloudWatch. It is located on the
&lt;a href="/docs/grafana/v13.2/explore/">Explore&lt;/a> page. For general documentation on querying data sources in Grafana, refer to
&lt;a href="/docs/grafana/v13.2/panels-visualizations/query-transform-data/">Query and transform data&lt;/a>.&lt;/p></description></item><item><title>CloudWatch template variables</title><link>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/template-variables/</link><pubDate>Tue, 18 Aug 2026 10:15:08 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/template-variables/</guid><content><![CDATA[&lt;h1 id=&#34;cloudwatch-template-variables&#34;&gt;CloudWatch template variables&lt;/h1&gt;
&lt;p&gt;Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables.
Grafana lists these variables in drop-down select boxes at the top of the dashboard to help you change the data displayed in your dashboard. Grafana refers to such variables as template variables.&lt;/p&gt;
&lt;p&gt;For an introduction to templating and template variables, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/dashboards/variables/&#34;&gt;Templating&lt;/a&gt; and 
    &lt;a href=&#34;/docs/grafana/v13.2/dashboards/variables/add-template-variables/&#34;&gt;Add and manage variables&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-query-variables&#34;&gt;Use query variables&lt;/h2&gt;
&lt;p&gt;You can specify these CloudWatch data source queries in the Variable edit view&amp;rsquo;s &lt;strong&gt;Query type&lt;/strong&gt; field.
Use them to fill a variable&amp;rsquo;s options list with values like &lt;code&gt;regions&lt;/code&gt;, &lt;code&gt;namespaces&lt;/code&gt;, &lt;code&gt;metric names&lt;/code&gt;, and &lt;code&gt;dimension keys/values&lt;/code&gt;.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;List returned&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Regions&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;All AWS regions.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Namespaces&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;All namespaces CloudWatch supports.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Metrics&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Metrics in the namespace. (Specify region or use &amp;ldquo;default&amp;rdquo; for custom metrics.)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Dimension Keys&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Dimension keys in the namespace.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Dimension Values&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Dimension values matching the specified &lt;code&gt;region&lt;/code&gt;, &lt;code&gt;namespace&lt;/code&gt;, &lt;code&gt;metric&lt;/code&gt;, and &lt;code&gt;dimension key&lt;/code&gt;. Use dimension &lt;code&gt;filters&lt;/code&gt; for more specific results.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;EBS Volume IDs&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Volume IDs matching the specified &lt;code&gt;region&lt;/code&gt; and &lt;code&gt;instance ID&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;EC2 Instance Attributes&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Attributes matching the specified &lt;code&gt;region&lt;/code&gt;, &lt;code&gt;attribute name&lt;/code&gt;, and &lt;code&gt;filters&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Resource ARNs&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;ARNs matching the specified &lt;code&gt;region&lt;/code&gt;, &lt;code&gt;resource type&lt;/code&gt;, and &lt;code&gt;tags&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Statistics&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;All standard statistics.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Log Groups&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Log groups matching the specified &lt;code&gt;region&lt;/code&gt; and optional log group &lt;code&gt;prefix&lt;/code&gt;. The variable value is the log group ARN.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Accounts&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The IDs of linked monitoring accounts for the specified &lt;code&gt;region&lt;/code&gt;. Available only when cross-account observability is enabled.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When cross-account observability is enabled, the &lt;strong&gt;Metrics&lt;/strong&gt;, &lt;strong&gt;Dimension Keys&lt;/strong&gt;, &lt;strong&gt;Dimension Values&lt;/strong&gt;, and &lt;strong&gt;Log Groups&lt;/strong&gt; query types also show an optional &lt;strong&gt;Account&lt;/strong&gt; field. Use it to target a specific linked monitoring account, or leave it unset to query all linked accounts. For more information, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/query-editor/#cross-account-observability&#34;&gt;Cross-account observability&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For details on the available dimensions, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch Metrics and Dimensions Reference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For details about the metrics CloudWatch provides, refer to the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;use-variables-in-queries&#34;&gt;Use variables in queries&lt;/h3&gt;
&lt;p&gt;Use the Grafana variable syntax to include variables in queries. A query variable dynamically retrieves values from your data source using a query.
For details, refer to the 
    &lt;a href=&#34;/docs/grafana/v13.2/dashboards/variables/variable-syntax/&#34;&gt;variable syntax documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;CloudWatch metric queries support variables in the &lt;strong&gt;Region&lt;/strong&gt;, &lt;strong&gt;Namespace&lt;/strong&gt;, &lt;strong&gt;Metric name&lt;/strong&gt;, dimension key, and dimension value fields.&lt;/p&gt;
&lt;p&gt;For example, if you create a variable named &lt;code&gt;region&lt;/code&gt; with the &lt;strong&gt;Regions&lt;/strong&gt; query type and a variable named &lt;code&gt;instance&lt;/code&gt; with the &lt;strong&gt;EC2 Instance Attributes&lt;/strong&gt; query type, you can reference them in a metric query by setting the query editor &lt;strong&gt;Region&lt;/strong&gt; to &lt;code&gt;$region&lt;/code&gt; and a dimension value to &lt;code&gt;$instance&lt;/code&gt;. The dashboard then updates as you change the selected region and instance.&lt;/p&gt;
&lt;h2 id=&#34;query-ec2-instance-attributes&#34;&gt;Query EC2 instance attributes&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;EC2 Instance Attributes&lt;/strong&gt; query type retrieves instance metadata using the AWS &lt;a href=&#34;http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;ec2:DescribeInstances&lt;/code&gt;&lt;/a&gt; API. Configure it with the following fields in the variable editor:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Region:&lt;/strong&gt; The AWS region to query.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Attribute name:&lt;/strong&gt; The instance attribute to return for each matching instance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Filters:&lt;/strong&gt; &lt;em&gt;Optional.&lt;/em&gt; Filters that limit which instances are returned.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The earlier &lt;code&gt;ec2_instance_attribute(region, attributeName, filters)&lt;/code&gt; query syntax is still supported. Grafana automatically migrates existing variables that use it to the EC2 Instance Attributes query type.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;filters&#34;&gt;Filters&lt;/h3&gt;
&lt;p&gt;Each filter has a key and a comma-separated list of matching values. Use the &lt;a href=&#34;http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;filters supported by &lt;code&gt;ec2:DescribeInstances&lt;/code&gt;&lt;/a&gt;, such as instance properties. To filter by tag, use a key in the form &lt;code&gt;tag:&amp;lt;name&amp;gt;&lt;/code&gt;, for example &lt;code&gt;tag:Environment&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;select-attributes&#34;&gt;Select attributes&lt;/h3&gt;
&lt;p&gt;A query returns one attribute per instance. You can select any attribute that has a single value and isn&amp;rsquo;t an object or array, also known as a flat attribute. These attributes mirror the fields of the AWS EC2 &lt;a href=&#34;https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Instance.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;Instance&lt;/code&gt;&lt;/a&gt; object, where you can find a definition of each one. Because the available attributes track the AWS API, the following list might not be exhaustive:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AmiLaunchIndex&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Architecture&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ClientToken&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;EbsOptimized&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;EnaSupport&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Hypervisor&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ImageId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;InstanceId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;InstanceLifecycle&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;InstanceType&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;KernelId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;KeyName&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;LaunchTime&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Platform&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PrivateDnsName&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PrivateIpAddress&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PublicDnsName&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PublicIpAddress&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RamdiskId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RootDeviceName&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RootDeviceType&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SourceDestCheck&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SpotInstanceRequestId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SriovNetSupport&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SubnetId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;VirtualizationType&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;VpcId&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Some attributes are objects rather than flat values. To select a nested value, use dot notation, for example &lt;code&gt;IamInstanceProfile.Arn&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To select a tag value, prepend the tag name with &lt;code&gt;Tags.&lt;/code&gt;. For example, select the &lt;code&gt;Name&lt;/code&gt; tag by using &lt;code&gt;Tags.Name&lt;/code&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="cloudwatch-template-variables">CloudWatch template variables&lt;/h1>
&lt;p>Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables.
Grafana lists these variables in drop-down select boxes at the top of the dashboard to help you change the data displayed in your dashboard. Grafana refers to such variables as template variables.&lt;/p></description></item><item><title>Amazon CloudWatch annotations</title><link>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/annotations/</link><pubDate>Tue, 18 Aug 2026 10:15:08 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/annotations/</guid><content><![CDATA[&lt;h1 id=&#34;amazon-cloudwatch-annotations&#34;&gt;Amazon CloudWatch annotations&lt;/h1&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/grafana/v13.2/dashboards/build-dashboards/annotate-visualizations/&#34;&gt;Annotations&lt;/a&gt; overlay rich event information on top of graphs. With the Amazon CloudWatch data source, annotations are based on &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch alarm history&lt;/a&gt;. Each alarm history item within the dashboard time range—such as a state change, configuration update, or action—becomes an annotation, so you can correlate alarm activity with the rest of your dashboard data.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before you create CloudWatch annotations, ensure you have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/&#34;&gt;configured Amazon CloudWatch data source&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;One or more CloudWatch alarms in the AWS account and region you want to query.&lt;/li&gt;
&lt;li&gt;IAM permissions to describe alarms and alarm history. Refer to &lt;a href=&#34;#required-permissions&#34;&gt;Required permissions&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;how-cloudwatch-annotations-work&#34;&gt;How CloudWatch annotations work&lt;/h2&gt;
&lt;p&gt;Unlike data sources that build annotations from free-form queries, CloudWatch annotations query existing CloudWatch alarms and return their state-change history. Grafana finds the matching alarms using one of two methods, retrieves each alarm&amp;rsquo;s history with &lt;code&gt;cloudwatch:DescribeAlarmHistory&lt;/code&gt;, and renders every history item as an annotation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Match alarms by metric:&lt;/strong&gt; Grafana calls &lt;code&gt;cloudwatch:DescribeAlarmsForMetric&lt;/code&gt; to find alarms attached to a specific metric.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Match alarms by prefix:&lt;/strong&gt; Grafana calls &lt;code&gt;cloudwatch:DescribeAlarms&lt;/code&gt; with your alarm name and action prefixes, so AWS returns only alarms whose names and actions start with those prefixes. Grafana then filters the returned alarms by the namespace, metric name, dimensions, statistic, and period you specify.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Each annotation includes the alarm name as its title, the alarm history item type as a tag (for example, &lt;code&gt;StateUpdate&lt;/code&gt;, &lt;code&gt;ConfigurationUpdate&lt;/code&gt;, or &lt;code&gt;Action&lt;/code&gt;), and the history summary as its text.&lt;/p&gt;
&lt;h2 id=&#34;create-an-annotation-query&#34;&gt;Create an annotation query&lt;/h2&gt;
&lt;p&gt;To add a CloudWatch annotation to a dashboard:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the dashboard where you want to add annotations.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Edit&lt;/strong&gt;, then click &lt;strong&gt;Settings&lt;/strong&gt; in the top navigation.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Annotations&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add annotation query&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a &lt;strong&gt;Name&lt;/strong&gt; for the annotation, for example, &lt;code&gt;CloudWatch alarms&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Select your &lt;strong&gt;Amazon CloudWatch&lt;/strong&gt; data source.&lt;/li&gt;
&lt;li&gt;Configure the query fields described in the following sections.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save dashboard&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The annotation query editor provides the following fields:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Field&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Region&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The AWS region to query for alarms.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Namespace&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The metric namespace, for example, &lt;code&gt;AWS/EC2&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Metric name&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The name of the metric the alarm watches, for example, &lt;code&gt;CPUUtilization&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Statistic&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The statistic the alarm uses, for example, &lt;code&gt;Average&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Dimensions&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The dimensions that identify the resource, for example, &lt;code&gt;InstanceId&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Period&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Optional.&lt;/em&gt; The minimum interval between data points, in seconds. Defaults to &lt;code&gt;300&lt;/code&gt; when prefix matching is disabled.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Enable Prefix Matching&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;em&gt;Optional.&lt;/em&gt; Match alarms by name and action prefix instead of by metric.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Action&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Match only alarms whose actions start with this prefix. Available when prefix matching is enabled, and required for the query to run.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Alarm Name&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Match only alarms whose names start with this prefix. Available when prefix matching is enabled, and required for the query to run.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;match-alarms-by-metric&#34;&gt;Match alarms by metric&lt;/h3&gt;
&lt;p&gt;This is the default behavior, used when &lt;strong&gt;Enable Prefix Matching&lt;/strong&gt; is off. Grafana returns annotations for any alarm attached to the metric you specify.&lt;/p&gt;
&lt;p&gt;When you match by metric, &lt;strong&gt;Region&lt;/strong&gt;, &lt;strong&gt;Namespace&lt;/strong&gt;, &lt;strong&gt;Metric name&lt;/strong&gt;, and &lt;strong&gt;Statistic&lt;/strong&gt; are all required. If any of them are missing, the query returns an &lt;code&gt;invalid annotations query&lt;/code&gt; error. Dimensions are optional, but adding them narrows the results to alarms on a specific resource.&lt;/p&gt;
&lt;p&gt;For example, to annotate the history of the CPU utilization alarm on a single EC2 instance, set:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Region:&lt;/strong&gt; &lt;code&gt;us-east-1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Namespace:&lt;/strong&gt; &lt;code&gt;AWS/EC2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metric name:&lt;/strong&gt; &lt;code&gt;CPUUtilization&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Statistic:&lt;/strong&gt; &lt;code&gt;Average&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dimensions:&lt;/strong&gt; &lt;code&gt;InstanceId = i-0123456789abcdef0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;match-alarms-by-prefix&#34;&gt;Match alarms by prefix&lt;/h3&gt;
&lt;p&gt;Enable &lt;strong&gt;Enable Prefix Matching&lt;/strong&gt; to find alarms by name and action prefix rather than by a specific metric. Grafana requests up to 100 alarms from &lt;code&gt;cloudwatch:DescribeAlarms&lt;/code&gt; using the &lt;strong&gt;Alarm Name&lt;/strong&gt; and &lt;strong&gt;Action&lt;/strong&gt; prefixes, then filters the returned alarms by the namespace, metric name, dimensions, statistic, and period you specify. You must provide both an &lt;strong&gt;Alarm Name&lt;/strong&gt; prefix and an &lt;strong&gt;Action&lt;/strong&gt; prefix for the query to run.&lt;/p&gt;
&lt;p&gt;Use prefix matching when you want to surface a group of related alarms, for example, all production alarms that trigger a specific SNS action. To do this, set &lt;strong&gt;Enable Prefix Matching&lt;/strong&gt; on, then set &lt;strong&gt;Alarm Name&lt;/strong&gt; to &lt;code&gt;prod-&lt;/code&gt; and &lt;strong&gt;Action&lt;/strong&gt; to the ARN prefix of your SNS topic, such as &lt;code&gt;arn:aws:sns:us-east-1:123456789012:prod-&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;required-permissions&#34;&gt;Required permissions&lt;/h2&gt;
&lt;p&gt;Annotation queries require the following CloudWatch API actions in the IAM policy attached to the role or user running the data source:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
  &amp;#34;Statement&amp;#34;: [
    {
      &amp;#34;Sid&amp;#34;: &amp;#34;AllowReadingAlarmsFromCloudWatch&amp;#34;,
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Action&amp;#34;: [&amp;#34;cloudwatch:DescribeAlarms&amp;#34;, &amp;#34;cloudwatch:DescribeAlarmsForMetric&amp;#34;, &amp;#34;cloudwatch:DescribeAlarmHistory&amp;#34;],
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The metrics IAM policy on the 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/#iam-policy-examples&#34;&gt;configure page&lt;/a&gt; already includes these actions.&lt;/p&gt;
&lt;h2 id=&#34;troubleshoot-annotations&#34;&gt;Troubleshoot annotations&lt;/h2&gt;
&lt;p&gt;If annotations don&amp;rsquo;t appear as expected, try the following solutions.&lt;/p&gt;
&lt;h3 id=&#34;annotations-dont-appear&#34;&gt;Annotations don&amp;rsquo;t appear&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Verify the alarm has state changes within the dashboard time range. Annotations come from alarm history, so an alarm that never changed state produces no annotations.&lt;/li&gt;
&lt;li&gt;Confirm the &lt;strong&gt;Region&lt;/strong&gt;, &lt;strong&gt;Namespace&lt;/strong&gt;, &lt;strong&gt;Metric name&lt;/strong&gt;, &lt;strong&gt;Statistic&lt;/strong&gt;, and &lt;strong&gt;Dimensions&lt;/strong&gt; exactly match an existing alarm.&lt;/li&gt;
&lt;li&gt;Check that the IAM role or user has the &lt;code&gt;cloudwatch:DescribeAlarms&lt;/code&gt;, &lt;code&gt;cloudwatch:DescribeAlarmsForMetric&lt;/code&gt;, and &lt;code&gt;cloudwatch:DescribeAlarmHistory&lt;/code&gt; permissions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;invalid-annotations-query-error&#34;&gt;&lt;code&gt;invalid annotations query&lt;/code&gt; error&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;This error appears when prefix matching is disabled and the query reaches the backend with an empty &lt;strong&gt;Region&lt;/strong&gt;, &lt;strong&gt;Namespace&lt;/strong&gt;, &lt;strong&gt;Metric name&lt;/strong&gt;, or &lt;strong&gt;Statistic&lt;/strong&gt;. Provide all four fields, or enable &lt;strong&gt;Enable Prefix Matching&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the dashboard annotation editor, an incomplete metric query is often skipped silently and produces no annotations rather than returning this error. If you see no annotations, confirm that all required fields are set.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;related-resources&#34;&gt;Related resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.2/dashboards/build-dashboards/annotate-visualizations/&#34;&gt;Annotate visualizations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/query-editor/&#34;&gt;Amazon CloudWatch query editor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/&#34;&gt;Configure the Amazon CloudWatch data source&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="amazon-cloudwatch-annotations">Amazon CloudWatch annotations&lt;/h1>
&lt;p>
&lt;a href="/docs/grafana/v13.2/dashboards/build-dashboards/annotate-visualizations/">Annotations&lt;/a> overlay rich event information on top of graphs. With the Amazon CloudWatch data source, annotations are based on &lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html" target="_blank" rel="noopener noreferrer">CloudWatch alarm history&lt;/a>. Each alarm history item within the dashboard time range—such as a state change, configuration update, or action—becomes an annotation, so you can correlate alarm activity with the rest of your dashboard data.&lt;/p></description></item><item><title>Amazon CloudWatch alerting</title><link>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/alerting/</link><pubDate>Tue, 18 Aug 2026 10:15:08 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/alerting/</guid><content><![CDATA[&lt;h1 id=&#34;amazon-cloudwatch-alerting&#34;&gt;Amazon CloudWatch alerting&lt;/h1&gt;
&lt;p&gt;The Amazon CloudWatch data source supports 
    &lt;a href=&#34;/docs/grafana/v13.2/alerting/&#34;&gt;Grafana Alerting&lt;/a&gt;. You can create alert rules on CloudWatch metrics and CloudWatch Logs, so Grafana notifies you when a metric crosses a threshold or when a log query returns a value that meets your alert condition.&lt;/p&gt;
&lt;p&gt;This is Grafana Alerting evaluated by Grafana, not CloudWatch alarms. To visualize the history of existing CloudWatch alarms instead, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/annotations/&#34;&gt;Amazon CloudWatch annotations&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before you create alert rules with CloudWatch data, ensure you have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/&#34;&gt;configured Amazon CloudWatch data source&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Permissions to create alert rules in Grafana.&lt;/li&gt;
&lt;li&gt;Familiarity with 
    &lt;a href=&#34;/docs/grafana/v13.2/alerting/fundamentals/&#34;&gt;Grafana Alerting concepts&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;supported-query-types-for-alerting&#34;&gt;Supported query types for alerting&lt;/h2&gt;
&lt;p&gt;Alert rules require queries that return numeric data that Grafana can evaluate against a threshold. CloudWatch supports alerting for the following query types:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Query type&lt;/th&gt;
              &lt;th&gt;Use case&lt;/th&gt;
              &lt;th&gt;Notes&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Metrics&lt;/td&gt;
              &lt;td&gt;Threshold-based alerts on CloudWatch metrics&lt;/td&gt;
              &lt;td&gt;Returns time series data; best suited for alerting.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Logs&lt;/td&gt;
              &lt;td&gt;Alert on log patterns, error counts, or thresholds&lt;/td&gt;
              &lt;td&gt;Use the &lt;code&gt;stats&lt;/code&gt; command to aggregate logs into numeric values.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;You can&amp;rsquo;t create an alert rule from a metric math expression that references another query, such as &lt;code&gt;queryA * 2&lt;/code&gt;. Define the metric directly in the alert query instead.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;create-an-alert-rule&#34;&gt;Create an alert rule&lt;/h2&gt;
&lt;p&gt;To create an alert rule using CloudWatch data:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Alerting&lt;/strong&gt; &amp;gt; &lt;strong&gt;Alert rules&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New alert rule&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a name for your alert rule.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Define query and alert condition&lt;/strong&gt; section:
&lt;ul&gt;
&lt;li&gt;Select your Amazon CloudWatch data source.&lt;/li&gt;
&lt;li&gt;Configure your query, for example, a Metrics query for &lt;code&gt;CPUUtilization&lt;/code&gt; or a Logs query that uses the &lt;code&gt;stats&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;Add a &lt;strong&gt;Reduce&lt;/strong&gt; expression if your query returns multiple series.&lt;/li&gt;
&lt;li&gt;Add a &lt;strong&gt;Threshold&lt;/strong&gt; expression to define the alert condition.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Configure the &lt;strong&gt;Set evaluation behavior&lt;/strong&gt; section:
&lt;ul&gt;
&lt;li&gt;Select or create a folder and evaluation group.&lt;/li&gt;
&lt;li&gt;Set the evaluation interval.&lt;/li&gt;
&lt;li&gt;Set the pending period.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add labels and annotations to provide context for notifications.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save rule&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For detailed instructions, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/alerting/alerting-rules/create-grafana-managed-rule/&#34;&gt;Create a Grafana-managed alert rule&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;example-metric-threshold-alert&#34;&gt;Example: metric threshold alert&lt;/h2&gt;
&lt;p&gt;This example fires when average EC2 CPU utilization exceeds 80%:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new alert rule.&lt;/li&gt;
&lt;li&gt;Configure the query:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Namespace&lt;/strong&gt;: &lt;code&gt;AWS/EC2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metric name&lt;/strong&gt;: &lt;code&gt;CPUUtilization&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Statistic&lt;/strong&gt;: &lt;code&gt;Average&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dimensions&lt;/strong&gt;: &lt;code&gt;InstanceId&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add expressions:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reduce&lt;/strong&gt;: Last, to get the most recent data point.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Threshold&lt;/strong&gt;: Is above 80.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Set evaluation to run every 1 minute with a 5-minute pending period.&lt;/li&gt;
&lt;li&gt;Save the rule.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;example-log-error-count-alert&#34;&gt;Example: log error count alert&lt;/h2&gt;
&lt;p&gt;This example alerts when the number of log entries that contain &lt;code&gt;Exception&lt;/code&gt; exceeds a threshold. CloudWatch Logs alerting requires a query that returns numeric data, which you can produce with the &lt;code&gt;stats&lt;/code&gt; command:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a new alert rule.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the query:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Select &lt;strong&gt;CloudWatch Logs&lt;/strong&gt; as the query mode.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the region and log groups to query.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the following query:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;filter @message like /Exception/
    | stats count(*) as exceptionCount by bin(5m)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add expressions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reduce&lt;/strong&gt;: Max, to get the highest count in the period.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Threshold&lt;/strong&gt;: Is above 10.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set evaluation to run every 5 minutes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Save the rule.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;If you receive an error such as &lt;code&gt;input data must be a wide series but got ...&lt;/code&gt;, make sure your query returns numeric data that can render in a time series panel.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;cloudwatch-logs-timeouts-during-alert-evaluation&#34;&gt;CloudWatch Logs timeouts during alert evaluation&lt;/h2&gt;
&lt;p&gt;For CloudWatch Logs queries, Grafana polls AWS until the query completes or a timeout is reached. During alert evaluation, the timeout defined in the 
    &lt;a href=&#34;/docs/grafana/v13.2/setup-grafana/configure-grafana/&#34;&gt;Grafana configuration file&lt;/a&gt; takes precedence over the &lt;strong&gt;Query Result Timeout&lt;/strong&gt; setting on the data source. Set the configuration timeout high enough for your log queries to finish.&lt;/p&gt;
&lt;h2 id=&#34;best-practices&#34;&gt;Best practices&lt;/h2&gt;
&lt;p&gt;Follow these recommendations to create reliable alerts with CloudWatch data.&lt;/p&gt;
&lt;h3 id=&#34;test-queries-before-alerting&#34;&gt;Test queries before alerting&lt;/h3&gt;
&lt;p&gt;Verify your query returns numeric data before you create an alert:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Explore&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select your Amazon CloudWatch data source.&lt;/li&gt;
&lt;li&gt;Run the query you plan to use for alerting.&lt;/li&gt;
&lt;li&gt;Confirm the result is numeric and suitable for threshold evaluation.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;reduce-multiple-series&#34;&gt;Reduce multiple series&lt;/h3&gt;
&lt;p&gt;When a query returns multiple time series, use the &lt;strong&gt;Reduce&lt;/strong&gt; expression to aggregate them into a single value with &lt;strong&gt;Last&lt;/strong&gt;, &lt;strong&gt;Mean&lt;/strong&gt;, &lt;strong&gt;Max&lt;/strong&gt;, &lt;strong&gt;Min&lt;/strong&gt;, or &lt;strong&gt;Sum&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&#34;handle-no-data-conditions&#34;&gt;Handle no data conditions&lt;/h3&gt;
&lt;p&gt;Configure how the rule behaves when no data is returned under &lt;strong&gt;Configure no data and error handling&lt;/strong&gt;. Choose &lt;strong&gt;No Data&lt;/strong&gt;, &lt;strong&gt;Alerting&lt;/strong&gt;, or &lt;strong&gt;OK&lt;/strong&gt; based on whether missing data should be treated as a problem.&lt;/p&gt;
&lt;h2 id=&#34;troubleshoot-alerting&#34;&gt;Troubleshoot alerting&lt;/h2&gt;
&lt;p&gt;If your CloudWatch alerts don&amp;rsquo;t work as expected, use the following sections to diagnose common issues.&lt;/p&gt;
&lt;h3 id=&#34;alerts-dont-fire&#34;&gt;Alerts don&amp;rsquo;t fire&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Confirm the query returns numeric data in Explore.&lt;/li&gt;
&lt;li&gt;Ensure the evaluation interval allows enough time for data to be available.&lt;/li&gt;
&lt;li&gt;Review the alert rule&amp;rsquo;s health and any error messages in the Alerting UI.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;log-query-alerts-time-out&#34;&gt;Log query alerts time out&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Increase the Grafana configuration file timeout, which takes precedence during alert evaluation.&lt;/li&gt;
&lt;li&gt;Narrow the time range or add filters to reduce the volume of data the query scans.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more help, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/troubleshooting/&#34;&gt;Troubleshoot Amazon CloudWatch&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;related-resources&#34;&gt;Related resources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.2/alerting/&#34;&gt;Grafana Alerting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.2/alerting/alerting-rules/create-grafana-managed-rule/&#34;&gt;Create a Grafana-managed alert rule&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/query-editor/&#34;&gt;Amazon CloudWatch query editor&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="amazon-cloudwatch-alerting">Amazon CloudWatch alerting&lt;/h1>
&lt;p>The Amazon CloudWatch data source supports
&lt;a href="/docs/grafana/v13.2/alerting/">Grafana Alerting&lt;/a>. You can create alert rules on CloudWatch metrics and CloudWatch Logs, so Grafana notifies you when a metric crosses a threshold or when a log query returns a value that meets your alert condition.&lt;/p></description></item><item><title>Troubleshoot Amazon CloudWatch data source issues</title><link>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/troubleshooting/</link><pubDate>Tue, 18 Aug 2026 10:15:08 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/datasources/aws-cloudwatch/troubleshooting/</guid><content><![CDATA[&lt;h1 id=&#34;troubleshoot-amazon-cloudwatch-data-source-issues&#34;&gt;Troubleshoot Amazon CloudWatch data source issues&lt;/h1&gt;
&lt;p&gt;This document provides solutions to common issues you may encounter when configuring or using the Amazon CloudWatch data source. For configuration instructions, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/&#34;&gt;Configure CloudWatch&lt;/a&gt;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The data source health check validates both metrics and logs permissions. If your IAM policy only grants access to one of these (for example, metrics-only or logs-only), the health check displays a red status. However, the service you have permissions for is still usable—you can query metrics or logs based on whichever permissions are configured.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;authentication-errors&#34;&gt;Authentication errors&lt;/h2&gt;
&lt;p&gt;These errors occur when AWS credentials are invalid, missing, or don&amp;rsquo;t have the required permissions. Use the following table to match the error message you see to its most likely cause and the section that resolves it.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Error message&lt;/th&gt;
              &lt;th&gt;Likely cause&lt;/th&gt;
              &lt;th&gt;Refer to&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;AccessDenied: User is not authorized to perform: cloudwatch:...&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The IAM policy is missing required CloudWatch permissions.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#access-denied-or-not-authorized-to-perform-this-operation&#34;&gt;Access Denied or Not authorized to perform this operation&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;InvalidClientTokenId&lt;/code&gt; or &lt;code&gt;UnrecognizedClientException: The security token included in the request is invalid&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Credentials are invalid, deactivated, or rotated, or a transient Grafana Cloud incident is in progress.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#invalidclienttokenid-or-unrecognizedclientexception&#34;&gt;InvalidClientTokenId or UnrecognizedClientException&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;AccessDenied: ... not authorized to perform: sts:AssumeRole&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The role trust relationship, role ARN, or external ID is incorrect.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#unable-to-assume-role&#34;&gt;Unable to assume role&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;AccessDenied: ... no VPC endpoint policy allows the cloudwatch:ListMetrics action&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A VPC endpoint policy or service control policy (SCP) blocks the action.&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#access-blocked-by-a-vpc-endpoint-policy-or-service-control-policy&#34;&gt;Access blocked by a VPC endpoint policy or service control policy&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;access-denied-or-not-authorized-to-perform-this-operation&#34;&gt;&amp;ldquo;Access Denied&amp;rdquo; or &amp;ldquo;Not authorized to perform this operation&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Save &amp;amp; test fails with &amp;ldquo;Access Denied&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Queries return authorization errors&lt;/li&gt;
&lt;li&gt;Namespaces, metrics, or dimensions don&amp;rsquo;t load&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Possible causes and solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Cause&lt;/th&gt;
              &lt;th&gt;Solution&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;IAM policy missing required permissions&lt;/td&gt;
              &lt;td&gt;Attach the appropriate IAM policy to your user or role. For metrics, you need &lt;code&gt;cloudwatch:ListMetrics&lt;/code&gt;, &lt;code&gt;cloudwatch:GetMetricData&lt;/code&gt;, and related permissions. For logs, you need &lt;code&gt;logs:DescribeLogGroups&lt;/code&gt;, &lt;code&gt;logs:StartQuery&lt;/code&gt;, &lt;code&gt;logs:GetQueryResults&lt;/code&gt;, and related permissions. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/&#34;&gt;Configure CloudWatch&lt;/a&gt; for complete policy examples.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Incorrect access key or secret key&lt;/td&gt;
              &lt;td&gt;Verify the credentials in the AWS Console under &lt;strong&gt;IAM&lt;/strong&gt; &amp;gt; &lt;strong&gt;Users&lt;/strong&gt; &amp;gt; your user &amp;gt; &lt;strong&gt;Security credentials&lt;/strong&gt;. Generate new credentials if necessary.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Credentials have expired&lt;/td&gt;
              &lt;td&gt;For temporary credentials, generate new ones. For access keys, verify they haven&amp;rsquo;t been deactivated or deleted.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Wrong AWS region&lt;/td&gt;
              &lt;td&gt;Verify the default region in the data source configuration matches where your resources are located.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;IAM role lacks permissions in the queried region&lt;/td&gt;
              &lt;td&gt;AWS evaluates permissions per region. If your role only has CloudWatch access in some regions, querying another region returns &lt;code&gt;AccessDenied&lt;/code&gt;, and the error might not name the region. Set the data source &lt;strong&gt;Default Region&lt;/strong&gt; to a region where your role has permissions, and only query regions your IAM policy allows.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Assume Role ARN is incorrect&lt;/td&gt;
              &lt;td&gt;Verify the role ARN format: &lt;code&gt;arn:aws:iam::&amp;lt;account-id&amp;gt;:role/&amp;lt;role-name&amp;gt;&lt;/code&gt;. Check that the role exists in the AWS Console.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;!-- vale Grafana.Headings = NO --&gt;
&lt;h3 id=&#34;invalidclienttokenid-or-unrecognizedclientexception&#34;&gt;&amp;ldquo;InvalidClientTokenId&amp;rdquo; or &amp;ldquo;UnrecognizedClientException&amp;rdquo;&lt;/h3&gt;
&lt;!-- vale Grafana.Headings = YES --&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Save &amp;amp; test fails with &lt;code&gt;InvalidClientTokenId: The security token included in the request is invalid&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Queries fail with &lt;code&gt;UnrecognizedClientException: The security token included in the request is invalid&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The error appears suddenly without any configuration change&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Possible causes and solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Cause&lt;/th&gt;
              &lt;th&gt;Solution&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Access key or secret key is invalid or mistyped&lt;/td&gt;
              &lt;td&gt;Verify the credentials in the AWS Console under &lt;strong&gt;IAM&lt;/strong&gt; &amp;gt; &lt;strong&gt;Users&lt;/strong&gt; &amp;gt; your user &amp;gt; &lt;strong&gt;Security credentials&lt;/strong&gt;. Re-enter them in the data source configuration.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Credentials were deactivated, deleted, or rotated&lt;/td&gt;
              &lt;td&gt;Generate new credentials in AWS and update the data source configuration.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Temporary credentials expired&lt;/td&gt;
              &lt;td&gt;Generate new temporary credentials, or switch to a long-lived authentication method such as Assume Role.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Transient Grafana Cloud incident&lt;/td&gt;
              &lt;td&gt;If multiple data sources fail at the same time with &lt;code&gt;InvalidClientTokenId&lt;/code&gt; and your credentials are unchanged, check the &lt;a href=&#34;https://status.grafana.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Cloud status page&lt;/a&gt; for an ongoing incident before you rotate credentials.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;unable-to-assume-role&#34;&gt;&amp;ldquo;Unable to assume role&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Authentication fails when using Assume Role ARN&lt;/li&gt;
&lt;li&gt;Error references STS or AssumeRole, for example, &lt;code&gt;AccessDenied: User is not authorized to perform: sts:AssumeRole&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the trust relationship on the IAM role allows the Grafana credentials to assume it.&lt;/li&gt;
&lt;li&gt;Check the trust policy includes the correct principal (the user or role running Grafana).&lt;/li&gt;
&lt;li&gt;If you use the &lt;strong&gt;Grafana Assume Role&lt;/strong&gt; authentication method, confirm the trust policy uses the exact Grafana AWS account ID and external ID shown in the instructions box on the data source&amp;rsquo;s &lt;strong&gt;Settings&lt;/strong&gt; tab. Entering a different account ID is a common mistake that causes the assume-role request to fail.&lt;/li&gt;
&lt;li&gt;If using an external ID, ensure it matches exactly in both the role&amp;rsquo;s trust policy and the Grafana data source configuration.&lt;/li&gt;
&lt;li&gt;Verify the base credentials have the &lt;code&gt;sts:AssumeRole&lt;/code&gt; permission.&lt;/li&gt;
&lt;li&gt;Check that the role ARN is correct and the role exists.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Example trust policy:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
  &amp;#34;Statement&amp;#34;: [
    {
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Principal&amp;#34;: {
        &amp;#34;AWS&amp;#34;: &amp;#34;arn:aws:iam::&amp;lt;your-account-id&amp;gt;:user/&amp;lt;grafana-user&amp;gt;&amp;#34;
      },
      &amp;#34;Action&amp;#34;: &amp;#34;sts:AssumeRole&amp;#34;,
      &amp;#34;Condition&amp;#34;: {
        &amp;#34;StringEquals&amp;#34;: {
          &amp;#34;sts:ExternalId&amp;#34;: &amp;#34;&amp;lt;your-external-id&amp;gt;&amp;#34;
        }
      }
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;save--test-passes-but-queries-return-no-data&#34;&gt;&amp;ldquo;Save &amp;amp; test&amp;rdquo; passes but queries return no data&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; succeeds, but panels and the query editor return no data&lt;/li&gt;
&lt;li&gt;Namespaces, metrics, or dimensions don&amp;rsquo;t load even though the connection test passed&lt;/li&gt;
&lt;li&gt;The issue appears only when you use an &lt;strong&gt;Assume Role ARN&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Possible causes and solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Cause&lt;/th&gt;
              &lt;th&gt;Solution&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;The connection test only validates the assume-role step&lt;/td&gt;
              &lt;td&gt;When you configure an &lt;strong&gt;Assume Role ARN&lt;/strong&gt;, &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; confirms that the primary credentials can perform &lt;code&gt;sts:AssumeRole&lt;/code&gt;. It doesn&amp;rsquo;t verify that the assumed role has CloudWatch or Logs permissions. Attach the required query permissions to the assumed role, not only to the primary credentials.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;The assumed role is missing CloudWatch permissions&lt;/td&gt;
              &lt;td&gt;Add the metrics and logs actions, such as &lt;code&gt;cloudwatch:ListMetrics&lt;/code&gt;, &lt;code&gt;cloudwatch:GetMetricData&lt;/code&gt;, &lt;code&gt;logs:DescribeLogGroups&lt;/code&gt;, and &lt;code&gt;logs:StartQuery&lt;/code&gt;, to the assumed role&amp;rsquo;s policy. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/&#34;&gt;Configure CloudWatch&lt;/a&gt; for complete policy examples.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Permissions are attached to the wrong identity&lt;/td&gt;
              &lt;td&gt;Confirm that the policy is attached to the role named in &lt;strong&gt;Assume Role ARN&lt;/strong&gt;, not to the IAM user or role that provides the primary credentials.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;data-source-stops-working-after-about-an-hour&#34;&gt;Data source stops working after about an hour&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The data source works initially, then queries fail after roughly an hour&lt;/li&gt;
&lt;li&gt;Errors reference an expired or invalid security token&lt;/li&gt;
&lt;li&gt;Saving the data source again, or restarting Grafana, temporarily restores access until it fails again&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Possible causes and solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Cause&lt;/th&gt;
              &lt;th&gt;Solution&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Temporary credentials expired and weren&amp;rsquo;t refreshed&lt;/td&gt;
              &lt;td&gt;Methods that use temporary credentials, such as Assume Role or STS, issue short-lived tokens. If the data source uses static temporary credentials, switch to an authentication method that refreshes automatically, such as Assume Role with long-lived base credentials or an EKS/EC2 instance role. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/&#34;&gt;AWS authentication&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;access-blocked-by-a-vpc-endpoint-policy-or-service-control-policy&#34;&gt;Access blocked by a VPC endpoint policy or service control policy&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Credentials are valid and the IAM policy grants the action, but requests still fail with &lt;code&gt;AccessDenied&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The error references a VPC endpoint policy, for example, &lt;code&gt;AccessDenied: ... no VPC endpoint policy allows the cloudwatch:ListMetrics action&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Access fails only from within a VPC or in a restricted account, such as a FedRAMP environment&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Possible causes and solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Cause&lt;/th&gt;
              &lt;th&gt;Solution&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;A VPC endpoint policy restricts which actions are allowed&lt;/td&gt;
              &lt;td&gt;Update the policy on the CloudWatch, Logs, EC2, or STS VPC endpoints to allow the required actions, such as &lt;code&gt;cloudwatch:ListMetrics&lt;/code&gt; and &lt;code&gt;cloudwatch:GetMetricData&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;A service control policy (SCP) explicitly denies a required action&lt;/td&gt;
              &lt;td&gt;Review the service control policies applied to the account or organizational unit. An explicit &lt;code&gt;Deny&lt;/code&gt; in an SCP overrides any &lt;code&gt;Allow&lt;/code&gt; in an IAM policy, so the action must be permitted at both levels.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Requests route through the wrong endpoint&lt;/td&gt;
              &lt;td&gt;Confirm that the data source region and any custom endpoint match the VPC endpoints that permit the required actions.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;aws-sdk-default-authentication-not-working&#34;&gt;AWS SDK Default authentication not working&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data source test fails when using AWS SDK Default&lt;/li&gt;
&lt;li&gt;Works locally but fails in production&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify AWS credentials are configured in the environment where Grafana runs.&lt;/li&gt;
&lt;li&gt;Check for credentials in the default locations:
&lt;ul&gt;
&lt;li&gt;Environment variables (&lt;code&gt;AWS_ACCESS_KEY_ID&lt;/code&gt;, &lt;code&gt;AWS_SECRET_ACCESS_KEY&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Shared credentials file (&lt;code&gt;~/.aws/credentials&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;EC2 instance metadata (if running on EC2)&lt;/li&gt;
&lt;li&gt;ECS task role (if running in ECS)&lt;/li&gt;
&lt;li&gt;EKS service account (if running in EKS)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Ensure the Grafana process has permission to read the credentials file.&lt;/li&gt;
&lt;li&gt;For EKS with IRSA, set the pod&amp;rsquo;s security context to allow user &lt;code&gt;472&lt;/code&gt; (&lt;code&gt;grafana&lt;/code&gt;) to access the projected token. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/aws-authentication/&#34;&gt;AWS authentication&lt;/a&gt; for details.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;credentials-file-not-found&#34;&gt;Credentials file not found&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Error indicates credentials file cannot be read&lt;/li&gt;
&lt;li&gt;Authentication fails with &amp;ldquo;Credentials file&amp;rdquo; option&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create the credentials file at &lt;code&gt;~/.aws/credentials&lt;/code&gt; for the user running the &lt;code&gt;grafana-server&lt;/code&gt; service.&lt;/li&gt;
&lt;li&gt;Verify the file has correct permissions (&lt;code&gt;0644&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;If the file exists but isn&amp;rsquo;t working, move it to &lt;code&gt;/usr/share/grafana/&lt;/code&gt; and set permissions to &lt;code&gt;0644&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Ensure the profile name in the data source configuration matches a profile in the credentials file.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;connection-errors&#34;&gt;Connection errors&lt;/h2&gt;
&lt;p&gt;These errors occur when Grafana cannot reach AWS CloudWatch endpoints.&lt;/p&gt;
&lt;h3 id=&#34;request-timed-out-or-connection-failures&#34;&gt;&amp;ldquo;Request timed out&amp;rdquo; or connection failures&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data source test times out&lt;/li&gt;
&lt;li&gt;Queries fail with timeout errors&lt;/li&gt;
&lt;li&gt;Intermittent connection issues&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify network connectivity from the Grafana server to AWS endpoints.&lt;/li&gt;
&lt;li&gt;Check firewall rules allow outbound HTTPS (port 443) to AWS services.&lt;/li&gt;
&lt;li&gt;If using a VPC, ensure proper NAT gateway or VPC endpoint configuration.&lt;/li&gt;
&lt;li&gt;For Grafana Cloud connecting to private resources, configure &lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/&#34;&gt;Private data source connect&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Check if the default region is correct—incorrect regions may cause longer timeouts.&lt;/li&gt;
&lt;li&gt;Increase the timeout settings if queries involve large data volumes.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;custom-endpoint-configuration-issues&#34;&gt;Custom endpoint configuration issues&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Connection fails when using a custom endpoint&lt;/li&gt;
&lt;li&gt;Endpoint URL rejected&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the endpoint URL format is correct.&lt;/li&gt;
&lt;li&gt;Ensure the endpoint is accessible from the Grafana server.&lt;/li&gt;
&lt;li&gt;Check that the endpoint supports the required AWS APIs.&lt;/li&gt;
&lt;li&gt;For VPC endpoints, verify the endpoint policy allows the required actions.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;cloudwatch-metrics-query-errors&#34;&gt;CloudWatch Metrics query errors&lt;/h2&gt;
&lt;p&gt;These errors occur when querying CloudWatch Metrics.&lt;/p&gt;
&lt;h3 id=&#34;no-data-or-empty-results&#34;&gt;&amp;ldquo;No data&amp;rdquo; or empty results&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Query executes without error but returns no data&lt;/li&gt;
&lt;li&gt;Charts show &amp;ldquo;No data&amp;rdquo; message&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Possible causes and solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Cause&lt;/th&gt;
              &lt;th&gt;Solution&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Time range doesn&amp;rsquo;t contain data&lt;/td&gt;
              &lt;td&gt;Expand the dashboard time range. CloudWatch metrics have different retention periods based on resolution.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Wrong namespace or metric name&lt;/td&gt;
              &lt;td&gt;Verify the namespace (for example, &lt;code&gt;AWS/EC2&lt;/code&gt;) and metric name (for example, &lt;code&gt;CPUUtilization&lt;/code&gt;) are correct.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Incorrect dimensions&lt;/td&gt;
              &lt;td&gt;Ensure dimension names and values match your AWS resources exactly.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Match Exact enabled incorrectly&lt;/td&gt;
              &lt;td&gt;When Match Exact is enabled, all dimensions must be specified. Try disabling it to see if metrics appear.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Period too large&lt;/td&gt;
              &lt;td&gt;Reduce the period setting or set it to &amp;ldquo;auto&amp;rdquo; to ensure data points are returned for your time range.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Custom metrics not configured&lt;/td&gt;
              &lt;td&gt;Add custom metric namespaces in the data source configuration under &lt;strong&gt;Namespaces of Custom Metrics&lt;/strong&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;metric-not-found-or-metrics-dont-appear-in-drop-down&#34;&gt;&amp;ldquo;Metric not found&amp;rdquo; or metrics don&amp;rsquo;t appear in drop-down&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Expected metrics don&amp;rsquo;t appear in the query editor&lt;/li&gt;
&lt;li&gt;Metric drop-down is empty for a namespace&lt;/li&gt;
&lt;li&gt;A specific metric is missing from the drop-down even though it exists in the CloudWatch console&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the metric exists in the selected region.&lt;/li&gt;
&lt;li&gt;For custom metrics, add the namespace to &lt;strong&gt;Namespaces of Custom Metrics&lt;/strong&gt; in the data source configuration.&lt;/li&gt;
&lt;li&gt;Check that the IAM policy includes &lt;code&gt;cloudwatch:ListMetrics&lt;/code&gt; permission.&lt;/li&gt;
&lt;li&gt;CloudWatch limits &lt;code&gt;ListMetrics&lt;/code&gt; to 500 results per page. To retrieve more metrics, increase the &lt;code&gt;list_metrics_page_limit&lt;/code&gt; setting in the 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/#configure-the-data-source-with-grafanaini&#34;&gt;Grafana configuration file&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Type the metric name directly into the &lt;strong&gt;Metric name&lt;/strong&gt; field. For some AWS namespaces, the data source uses a predefined metric list, so newer or less common metrics might not appear in the drop-down even though you can still query them. If the metric exists in your CloudWatch console, enter its exact name to query it.&lt;/li&gt;
&lt;li&gt;Use the Query Inspector to verify the API request and response.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;dimension-values-not-loading&#34;&gt;Dimension values not loading&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Dimension value drop-down doesn&amp;rsquo;t populate&lt;/li&gt;
&lt;li&gt;Wildcard searches return no results&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the IAM policy includes &lt;code&gt;cloudwatch:ListMetrics&lt;/code&gt; permission.&lt;/li&gt;
&lt;li&gt;Check that the namespace and metric are selected before dimension values can load.&lt;/li&gt;
&lt;li&gt;For EC2 dimensions, ensure &lt;code&gt;ec2:DescribeTags&lt;/code&gt; and &lt;code&gt;ec2:DescribeInstances&lt;/code&gt; permissions are granted.&lt;/li&gt;
&lt;li&gt;Dimension values require existing metrics—if no metrics match, no values appear.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;too-many-data-points-or-api-throttling&#34;&gt;&amp;ldquo;Too many data points&amp;rdquo; or API throttling&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Queries fail with throttling errors&lt;/li&gt;
&lt;li&gt;Performance degrades with multiple panels&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Increase the period setting to reduce the number of data points.&lt;/li&gt;
&lt;li&gt;Reduce the time range of your queries.&lt;/li&gt;
&lt;li&gt;Use fewer dimensions or wildcard queries per panel.&lt;/li&gt;
&lt;li&gt;Request a quota increase for &lt;code&gt;GetMetricData&lt;/code&gt; requests per second in the &lt;a href=&#34;https://console.aws.amazon.com/servicequotas/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS Service Quotas console&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Enable query caching in Grafana to reduce API calls.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This section covers throttling at the query level. For account-wide rate limits and quota increases, refer to &lt;a href=&#34;#api-throttling-errors&#34;&gt;API throttling errors&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;metric-math-expression-errors&#34;&gt;Metric math expression errors&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Expression returns errors&lt;/li&gt;
&lt;li&gt;Referenced metrics not found&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify each referenced metric has a unique ID set.&lt;/li&gt;
&lt;li&gt;Check that metric IDs start with a lowercase letter and contain only letters, numbers, and underscores.&lt;/li&gt;
&lt;li&gt;Ensure all referenced metrics are in the same query.&lt;/li&gt;
&lt;li&gt;Verify the expression syntax follows &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS Metric Math&lt;/a&gt; documentation.&lt;/li&gt;
&lt;li&gt;Metric math expressions can&amp;rsquo;t be used with Grafana alerting if they reference other query rows.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;cloudwatch-logs-query-errors&#34;&gt;CloudWatch Logs query errors&lt;/h2&gt;
&lt;p&gt;These errors occur when querying CloudWatch Logs.&lt;/p&gt;
&lt;h3 id=&#34;query-failed-or-logs-dont-appear&#34;&gt;&amp;ldquo;Query failed&amp;rdquo; or logs don&amp;rsquo;t appear&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Log queries return errors&lt;/li&gt;
&lt;li&gt;No log data is displayed&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify log group names are correct and exist in the selected region.&lt;/li&gt;
&lt;li&gt;Check the IAM policy includes &lt;code&gt;logs:StartQuery&lt;/code&gt;, &lt;code&gt;logs:GetQueryResults&lt;/code&gt;, and &lt;code&gt;logs:DescribeLogGroups&lt;/code&gt; permissions.&lt;/li&gt;
&lt;li&gt;Ensure the time range contains log data.&lt;/li&gt;
&lt;li&gt;Verify the query syntax is valid. For CloudWatch Logs Insights QL, test the query in the AWS Console.&lt;/li&gt;
&lt;li&gt;Select the correct query language (Logs Insights QL, OpenSearch PPL, or OpenSearch SQL) based on your query syntax.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;log-query-timeout&#34;&gt;Log query timeout&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Query runs for a long time then fails&lt;/li&gt;
&lt;li&gt;Error mentions timeout&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Increase the &lt;strong&gt;Query Result Timeout&lt;/strong&gt; setting in the data source configuration (default is 30 minutes).&lt;/li&gt;
&lt;li&gt;Narrow the time range to reduce the amount of data scanned.&lt;/li&gt;
&lt;li&gt;Add filters to your query to limit results.&lt;/li&gt;
&lt;li&gt;Break complex queries into smaller, more focused queries.&lt;/li&gt;
&lt;li&gt;For alerting, the timeout defined in the 
    &lt;a href=&#34;/docs/grafana/v13.2/setup-grafana/configure-grafana/#unified_alerting&#34;&gt;Grafana configuration file&lt;/a&gt; takes precedence.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;log-groups-not-appearing-in-selector&#34;&gt;Log groups not appearing in selector&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Log group selector is empty&lt;/li&gt;
&lt;li&gt;Can&amp;rsquo;t find expected log groups&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the IAM policy includes &lt;code&gt;logs:DescribeLogGroups&lt;/code&gt; permission.&lt;/li&gt;
&lt;li&gt;Check that log groups exist in the selected region.&lt;/li&gt;
&lt;li&gt;For cross-account observability, ensure proper IAM permissions for &lt;code&gt;oam:ListSinks&lt;/code&gt; and &lt;code&gt;oam:ListAttachedLinks&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Use prefix search to filter log groups if you have many groups.&lt;/li&gt;
&lt;li&gt;Verify the selected account (for cross-account) contains the expected log groups.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;opensearch-sql-query-errors&#34;&gt;OpenSearch SQL query errors&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;OpenSearch SQL queries fail&lt;/li&gt;
&lt;li&gt;Syntax errors with SQL queries&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Specify the log group identifier or ARN in the &lt;code&gt;FROM&lt;/code&gt; clause:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM `log_group_name` WHERE `@message` LIKE &amp;#39;%error%&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For multiple log groups, use the &lt;code&gt;logGroups&lt;/code&gt; function:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM `logGroups(logGroupIdentifier: [&amp;#39;LogGroup1&amp;#39;, &amp;#39;LogGroup2&amp;#39;])`&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Amazon CloudWatch supports only a subset of OpenSearch SQL commands. Refer to the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData_Languages.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch Logs documentation&lt;/a&gt; for supported syntax.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;template-variable-errors&#34;&gt;Template variable errors&lt;/h2&gt;
&lt;p&gt;These errors occur when using template variables with the CloudWatch data source.&lt;/p&gt;
&lt;h3 id=&#34;variables-return-no-values&#34;&gt;Variables return no values&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Variable drop-down is empty&lt;/li&gt;
&lt;li&gt;Dashboard fails to load with variable errors&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the data source connection is working.&lt;/li&gt;
&lt;li&gt;Check that the IAM policy includes permissions for the variable query type:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Regions:&lt;/strong&gt; No additional permissions needed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Namespaces:&lt;/strong&gt; No additional permissions needed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metrics:&lt;/strong&gt; Requires &lt;code&gt;cloudwatch:ListMetrics&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dimension Values:&lt;/strong&gt; Requires &lt;code&gt;cloudwatch:ListMetrics&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;EC2 Instance Attributes:&lt;/strong&gt; Requires &lt;code&gt;ec2:DescribeInstances&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;EBS Volume IDs:&lt;/strong&gt; Requires &lt;code&gt;ec2:DescribeVolumes&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resource ARNs:&lt;/strong&gt; Requires &lt;code&gt;tag:GetResources&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Log Groups:&lt;/strong&gt; Requires &lt;code&gt;logs:DescribeLogGroups&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;For dependent variables, ensure parent variables have valid selections.&lt;/li&gt;
&lt;li&gt;Verify the region is set correctly (use &amp;ldquo;default&amp;rdquo; for the data source&amp;rsquo;s default region).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For more information on template variables, refer to 
    &lt;a href=&#34;/docs/grafana/v13.2/datasources/aws-cloudwatch/template-variables/&#34;&gt;CloudWatch template variables&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;multi-value-template-variables-cause-query-failures&#34;&gt;Multi-value template variables cause query failures&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Queries fail when selecting multiple dimension values&lt;/li&gt;
&lt;li&gt;Error about search expression limits&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Search expressions are limited to 1,024 characters. Reduce the number of selected values.&lt;/li&gt;
&lt;li&gt;Use the asterisk (&lt;code&gt;*&lt;/code&gt;) wildcard instead of selecting &amp;ldquo;All&amp;rdquo; to query all metrics for a dimension.&lt;/li&gt;
&lt;li&gt;Multi-valued template variables are only supported for dimension values—not for Region, Namespace, or Metric Name.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;cross-account-observability-errors&#34;&gt;Cross-account observability errors&lt;/h2&gt;
&lt;p&gt;These errors occur when using CloudWatch cross-account observability features.&lt;/p&gt;
&lt;h3 id=&#34;cross-account-queries-fail&#34;&gt;Cross-account queries fail&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can&amp;rsquo;t query metrics or logs from linked accounts&lt;/li&gt;
&lt;li&gt;Monitoring account badge doesn&amp;rsquo;t appear&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Verify cross-account observability is configured in the AWS CloudWatch console.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the required IAM permissions:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
  &amp;#34;Statement&amp;#34;: [
    {
      &amp;#34;Action&amp;#34;: [&amp;#34;oam:ListSinks&amp;#34;, &amp;#34;oam:ListAttachedLinks&amp;#34;],
      &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
      &amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check that the monitoring account and source accounts are properly linked in AWS.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Cross-account observability works within a single region—verify all accounts are in the same region.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;EC2 Instance Attributes can&amp;rsquo;t be queried across accounts because they use the EC2 API, not the CloudWatch API.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;quota-and-pricing-issues&#34;&gt;Quota and pricing issues&lt;/h2&gt;
&lt;p&gt;These issues relate to AWS service quotas and cost management.&lt;/p&gt;
&lt;h3 id=&#34;api-throttling-errors&#34;&gt;API throttling errors&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;ldquo;Rate exceeded&amp;rdquo; errors&lt;/li&gt;
&lt;li&gt;Dashboard panels intermittently fail to load&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Reduce the frequency of dashboard refreshes.&lt;/li&gt;
&lt;li&gt;Increase the period setting to reduce &lt;code&gt;GetMetricData&lt;/code&gt; requests.&lt;/li&gt;
&lt;li&gt;Enable query caching in Grafana (available in Grafana Enterprise and Grafana Cloud).&lt;/li&gt;
&lt;li&gt;Request a quota increase in the &lt;a href=&#34;https://console.aws.amazon.com/servicequotas/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS Service Quotas console&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Consider consolidating similar queries using metric math.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If throttling happens because a single query returns too many data points, refer to &lt;a href=&#34;#too-many-data-points-or-api-throttling&#34;&gt;&amp;ldquo;Too many data points&amp;rdquo; or API throttling&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;unexpectedly-high-cloudwatch-costs&#34;&gt;Unexpectedly high CloudWatch costs&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;AWS CloudWatch costs are higher than expected&lt;/li&gt;
&lt;li&gt;Frequent API calls from Grafana&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;GetMetricData&lt;/code&gt; API doesn&amp;rsquo;t qualify for the CloudWatch API free tier.&lt;/li&gt;
&lt;li&gt;Reduce dashboard auto-refresh frequency.&lt;/li&gt;
&lt;li&gt;Increase the period setting to reduce data points returned.&lt;/li&gt;
&lt;li&gt;Use query caching to reduce repeated API calls.&lt;/li&gt;
&lt;li&gt;Review variable query settings—set variable refresh to &amp;ldquo;On dashboard load&amp;rdquo; instead of &amp;ldquo;On time range change.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Avoid using wildcards in dimensions when possible, as they generate search expressions with multiple API calls.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;other-common-issues&#34;&gt;Other common issues&lt;/h2&gt;
&lt;p&gt;These issues don&amp;rsquo;t produce specific error messages but are commonly encountered.&lt;/p&gt;
&lt;h3 id=&#34;custom-metrics-dont-appear&#34;&gt;Custom metrics don&amp;rsquo;t appear&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Custom metrics from applications or agents don&amp;rsquo;t show in the namespace drop-down&lt;/li&gt;
&lt;li&gt;Only standard AWS namespaces are visible&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add your custom metric namespace to the &lt;strong&gt;Namespaces of Custom Metrics&lt;/strong&gt; field in the data source configuration.&lt;/li&gt;
&lt;li&gt;Separate multiple namespaces with commas (for example, &lt;code&gt;CWAgent,CustomNamespace&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Verify custom metrics have been published to CloudWatch in the selected region.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;pre-configured-dashboards-not-working&#34;&gt;Pre-configured dashboards not working&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Imported dashboards show no data&lt;/li&gt;
&lt;li&gt;Dashboard variables don&amp;rsquo;t load&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the data source name in the dashboard matches your CloudWatch data source.&lt;/li&gt;
&lt;li&gt;Check that the dashboard&amp;rsquo;s AWS region setting matches where your resources are located.&lt;/li&gt;
&lt;li&gt;Ensure the IAM policy grants access to the required services (EC2, Lambda, RDS, etc.).&lt;/li&gt;
&lt;li&gt;Verify resources exist and are emitting metrics in the selected region.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;application-signals-trace-links-not-appearing&#34;&gt;Application Signals trace links not appearing&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Log entries don&amp;rsquo;t show Application Signals trace links&lt;/li&gt;
&lt;li&gt;&lt;code&gt;@xrayTraceId&lt;/code&gt; field not appearing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify an Application Signals data source is configured and linked in the CloudWatch data source settings.&lt;/li&gt;
&lt;li&gt;Ensure your logs contain the &lt;code&gt;@xrayTraceId&lt;/code&gt; field.&lt;/li&gt;
&lt;li&gt;Update log queries to include &lt;code&gt;@xrayTraceId&lt;/code&gt; in the fields, for example: &lt;code&gt;fields @message, @xrayTraceId&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Configure your application to log Application Signals trace IDs. Refer to the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Monitoring-Sections.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS Application Signals documentation&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;enable-debug-logging&#34;&gt;Enable debug logging&lt;/h2&gt;
&lt;p&gt;To capture detailed error information for troubleshooting:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Set the Grafana log level to &lt;code&gt;debug&lt;/code&gt; in the configuration file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;ini&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-ini&#34;&gt;[log]
level = debug&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Review logs in &lt;code&gt;/var/log/grafana/grafana.log&lt;/code&gt; (or your configured log location).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Look for CloudWatch-specific entries that include request and response details.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Reset the log level to &lt;code&gt;info&lt;/code&gt; after troubleshooting to avoid excessive log volume.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;get-additional-help&#34;&gt;Get additional help&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;ve tried the solutions above and still encounter issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check the &lt;a href=&#34;https://community.grafana.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana community forums&lt;/a&gt; for similar issues.&lt;/li&gt;
&lt;li&gt;Review the &lt;a href=&#34;https://github.com/grafana/grafana/issues&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch plugin GitHub issues&lt;/a&gt; for known bugs.&lt;/li&gt;
&lt;li&gt;Consult the &lt;a href=&#34;https://docs.aws.amazon.com/cloudwatch/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS CloudWatch documentation&lt;/a&gt; for service-specific guidance.&lt;/li&gt;
&lt;li&gt;Contact Grafana Support if you&amp;rsquo;re an Enterprise, Cloud Pro, or Cloud Contracted user.&lt;/li&gt;
&lt;li&gt;When reporting issues, include:
&lt;ul&gt;
&lt;li&gt;Grafana version&lt;/li&gt;
&lt;li&gt;AWS region&lt;/li&gt;
&lt;li&gt;Error messages (redact sensitive information)&lt;/li&gt;
&lt;li&gt;Steps to reproduce&lt;/li&gt;
&lt;li&gt;Query configuration (redact credentials and account IDs)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="troubleshoot-amazon-cloudwatch-data-source-issues">Troubleshoot Amazon CloudWatch data source issues&lt;/h1>
&lt;p>This document provides solutions to common issues you may encounter when configuring or using the Amazon CloudWatch data source. For configuration instructions, refer to
&lt;a href="/docs/grafana/v13.2/datasources/aws-cloudwatch/configure/">Configure CloudWatch&lt;/a>.&lt;/p></description></item></channel></rss>