<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/v12.4/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/v12.4/datasources/aws-cloudwatch/index.xml" rel="self" type="application/rss+xml"/><item><title>Configure CloudWatch</title><link>https://grafana.com/docs/grafana/v12.4/datasources/aws-cloudwatch/configure/</link><pubDate>Fri, 03 Apr 2026 12:35:46 -0500</pubDate><guid>https://grafana.com/docs/grafana/v12.4/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/v12.4/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;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/v12.4/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&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;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;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 timeout result&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;X-Ray 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 X-Ray 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 X-Ray data source if logs contain the &lt;code&gt;@xrayTraceId&lt;/code&gt; field. To use this feature, you must already have an X-Ray data source configured. For details, see the &lt;a href=&#34;/grafana/plugins/grafana-X-Ray-datasource/&#34;&gt;X-Ray data source docs&lt;/a&gt;. To view the X-Ray link, select the log row in either the Explore view or dashboard 
    &lt;a href=&#34;/docs/grafana/v12.4/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/xray/latest/devguide/xray-services.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS X-Ray 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. You should see a confirmation dialog box that says:&lt;/p&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/v12.4/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: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: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/v12.4/datasources/aws-cloudwatch/aws-authentication/&#34;&gt;Configure AWS authentication&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/v12.4/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. The following providers are enabled by default in open source Grafana: &lt;code&gt;default&lt;/code&gt; (AWS SDK default), &lt;code&gt;keys&lt;/code&gt; (Access and secret key), &lt;code&gt;credentials&lt;/code&gt; (Credentials file), &lt;code&gt;ec2_IAM_role&lt;/code&gt; (EC2 IAM role).&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;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/v12.4/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;
]]></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/v12.4/administration/data-source-management/">Data source management&lt;/a>.&lt;/p></description></item><item><title>Amazon CloudWatch query editor</title><link>https://grafana.com/docs/grafana/v12.4/datasources/aws-cloudwatch/query-editor/</link><pubDate>Fri, 03 Apr 2026 12:35:46 -0500</pubDate><guid>https://grafana.com/docs/grafana/v12.4/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/v12.4/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/v12.4/panels-visualizations/query-transform-data/&#34;&gt;Query and transform data&lt;/a&gt;.&lt;/p&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. Examples: &lt;code&gt;sum&lt;/code&gt;, &lt;code&gt;average&lt;/code&gt;, &lt;code&gt;maximum&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;. Valid values are 1, 5, 10, 30, or any multiple of 60. When set to auto or left blank, Grafana calculates the period using time range in seconds / 2000, then rounds up to the next value (60, 300, 900, 3600, 21600, 86400) based on the &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;CloudWatch retention policy&lt;/a&gt;.&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-mode&#34;&gt;Use Builder mode&lt;/h2&gt;
&lt;p&gt;Create a query in Builder mode:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Browse and select a metric namespace, metric name, filter, group, and order options using information from the &lt;a href=&#34;#use-metrics-insights-keywords&#34;&gt;Metrics Insights keywords table&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For each of these keywords, choose from the list of available options.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Grafana constructs a SQL query based on your selections.&lt;/p&gt;
&lt;h2 id=&#34;use-code-mode&#34;&gt;Use Code mode&lt;/h2&gt;
&lt;p&gt;You can also write your SQL query directly in a code editor by using Code mode.&lt;/p&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 help you retrieve and filter available metrics.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#use-metric-insights-syntax&#34;&gt;Metric Query&lt;/a&gt;, which use 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;The data source returns up to 100 metrics matching your filter criteria.&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. This feature supports up to 100 metrics.&lt;/p&gt;
&lt;p&gt;Click the 
    &lt;a href=&#34;/docs/grafana/v12.4/panels-visualizations/query-transform-data/#navigate-the-query-tab&#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/v12.4/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 set of log groups.&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 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;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;/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 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;You must specify a set of log groups to target for your query using 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.&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;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 must specify the region and log groups when querying with &lt;strong&gt;Logs Insights QL&lt;/strong&gt;, &lt;strong&gt;OpenSearch PPL&lt;/strong&gt;, and &lt;strong&gt;OpenSearch SQL&lt;/strong&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 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 with OpenSearch SQL&lt;/h3&gt;
&lt;p&gt;When querying log groups with OpenSearch SQL, you can use the &lt;code&gt;$__logGroups&lt;/code&gt; macro to automatically reference log groups selected in the query editor&amp;rsquo;s log group selector. This is the recommended approach as it allows you to manage log groups 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 `$__logGroups`
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;$__logGroups&lt;/code&gt; macro expands to the proper &lt;code&gt;logGroups(logGroupIdentifier: [...])&lt;/code&gt; syntax with the log groups 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/v12.4/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/v12.4/alerting/&#34;&gt;Alerting&lt;/a&gt;.&lt;/p&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/latest/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/v12.4/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/v12.4/explore/">Explore&lt;/a> page. For general documentation on querying data sources in Grafana, refer to
&lt;a href="/docs/grafana/v12.4/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/v12.4/datasources/aws-cloudwatch/template-variables/</link><pubDate>Fri, 03 Apr 2026 12:35:46 -0500</pubDate><guid>https://grafana.com/docs/grafana/v12.4/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, and they are called template variables&lt;/p&gt;
&lt;!-- Grafana refers to such variables as template variables. --&gt;
&lt;p&gt;For an introduction to templating and template variables, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/dashboards/variables/&#34;&gt;Templating&lt;/a&gt; and 
    &lt;a href=&#34;/docs/grafana/v12.4/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;LogGroups&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;All log groups matching the specified &lt;code&gt;region&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&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 in dynamically retrieves values from your data source using a query.
For details, refer to the 
    &lt;a href=&#34;/docs/grafana/v12.4/dashboards/variables/variable-syntax/&#34;&gt;variable syntax documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-ec2_instance_attribute&#34;&gt;Use ec2_instance_attribute&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;ec2_instance_attribute&lt;/code&gt; function in template variables allows Grafana to retrieve certain instance metadata from the EC2 metadata service, including &lt;code&gt;Instance ID&lt;/code&gt; and &lt;code&gt;region&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;filters&#34;&gt;Filters&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;ec2_instance_attribute&lt;/code&gt; query takes a &lt;code&gt;filters&lt;/code&gt; parameter, where each key is a filter name (such as a tag or instance property), and each value is a comma-separated list of matching values.&lt;/p&gt;
&lt;p&gt;You can specify &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;pre-defined filters of ec2:DescribeInstances&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;select-attributes&#34;&gt;Select attributes&lt;/h3&gt;
&lt;p&gt;A query returns only 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 &lt;code&gt;flat attribute&lt;/code&gt;:&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;IamInstanceProfile&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;You can select tags by prepending the tag name with &lt;code&gt;Tags.&lt;/code&gt;.
For example, select the tag &lt;code&gt;Name&lt;/code&gt; 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, and they are called template variables&lt;/p></description></item><item><title>Configure AWS authentication</title><link>https://grafana.com/docs/grafana/v12.4/datasources/aws-cloudwatch/aws-authentication/</link><pubDate>Fri, 03 Apr 2026 12:35:46 -0500</pubDate><guid>https://grafana.com/docs/grafana/v12.4/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 and secret key&lt;/code&gt; methods by default. Cloud Grafana enables only &lt;code&gt;Access and secret key&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/v12.4/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 and 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. Grafana Cloud uses this as the primary authentication method.&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 Grafana&amp;rsquo;s 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/latest/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/v12.4/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; (&amp;ldquo;grafana&amp;rdquo;).
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 only available in Grafana Cloud for Amazon CloudWatch and 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;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>Troubleshoot Amazon CloudWatch data source issues</title><link>https://grafana.com/docs/grafana/v12.4/datasources/aws-cloudwatch/troubleshooting/</link><pubDate>Fri, 03 Apr 2026 12:35:46 -0500</pubDate><guid>https://grafana.com/docs/grafana/v12.4/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/v12.4/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.&lt;/p&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/v12.4/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;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;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 message references STS or AssumeRole&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 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;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 472 (grafana) to access the projected token. Refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/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;/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/latest/datasources/aws-cloudwatch/configure/#configure-the-data-source-with-grafanaini&#34;&gt;Grafana configuration file&lt;/a&gt;.&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;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 timeout result&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/latest/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/v12.4/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;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;x-ray-trace-links-not-appearing&#34;&gt;X-Ray 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 X-Ray 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 X-Ray 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 X-Ray trace IDs. Refer to the &lt;a href=&#34;https://docs.aws.amazon.com/xray/latest/devguide/xray-services.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AWS X-Ray 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/v12.4/datasources/aws-cloudwatch/configure/">Configure CloudWatch&lt;/a>.&lt;/p></description></item></channel></rss>