<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>AWS CloudWatch on Grafana Labs</title><link>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/</link><description>Recent content in AWS CloudWatch on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v8.4/datasources/aws-cloudwatch/index.xml" rel="self" type="application/rss+xml"/><item><title>Authentication</title><link>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/aws-authentication/</link><pubDate>Sat, 04 Apr 2026 12:26:57 +0000</pubDate><guid>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/aws-authentication/</guid><content><![CDATA[&lt;h1 id=&#34;aws-authentication&#34;&gt;AWS authentication&lt;/h1&gt;
&lt;p&gt;Requests from a Grafana plugin to AWS are made on behalf of an IAM role or an IAM user. The IAM user or IAM role must have the associated policies to perform certain API actions. Since these policies are specific to each data source, refer to the data source documentation for details.&lt;/p&gt;
&lt;p&gt;All requests to AWS APIs are performed on the server side by the Grafana backend using the official AWS SDK.&lt;/p&gt;
&lt;p&gt;This topic has the following sections:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#authentication-methods&#34;&gt;Authentication methods&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#assuming-a-role&#34;&gt;Assuming a role&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#endpoint&#34;&gt;Endpoint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#aws-credentials-file&#34;&gt;AWS credentials file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#eks-iam-roles-for-service-accounts&#34;&gt;EKS IAM roles for service accounts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;authentication-methods&#34;&gt;Authentication methods&lt;/h2&gt;
&lt;p&gt;You can use one of the following authentication methods. Currently, &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; are enabled by default in open source Grafana. You can enable/disable them if necessary if you have server configuration access. For more information, refer to &lt;a href=&#34;../../../administration/configuration/#allowed_auth_providers&#34;&gt;allowed_auth_providers&lt;/a&gt; documentation.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;AWS SDK Default&lt;/code&gt; performs no custom configuration and instead 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; as specified by the AWS SDK for Go. It requires you to configure your AWS credentials separately, such as if you&amp;rsquo;ve &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;configured the CLI&lt;/a&gt;, if you&amp;rsquo;re &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;running on 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;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Credentials file&lt;/code&gt; corresponds directly 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 Go SDK. It reads the AWS shared credentials file to find a given profile. While &lt;code&gt;AWS SDK Default&lt;/code&gt; will also find the shared credentials file, this option allows you to specify which profile to use without using environment variables. This option doesn&amp;rsquo;t have any implicit fallbacks to other credential providers, and it fails if the credentials provided from the file aren&amp;rsquo;t correct.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&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 uses the given access key ID and secret key to authenticate. This method doesn&amp;rsquo;t have any fallbacks, and will fail if the provided key pair doesn&amp;rsquo;t work.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&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 pulls credentials for a role attached to the EC2 instance that Grafana runs on. You can also achieve this by using the authentication method AWS SDK Default, but this option is different as it doesn’t have any fallbacks. This option is currently only enabled by default in Amazon Managed Grafana.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;assuming-a-role&#34;&gt;Assuming a role&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;Assume Role ARN&lt;/code&gt; field allows you to specify which IAM role to assume. When left blank, the provided credentials are used directly and the associated role or user should have the required permissions. If this field is non-blank, on the other hand, the provided credentials are used 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.&lt;/p&gt;
&lt;p&gt;You can disable this feature in the Grafana configuration. For more information, refer to &lt;a href=&#34;../../../administration/configuration/#assume_role_enabled&#34;&gt;assume_role_enabled&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h3 id=&#34;external-id&#34;&gt;External ID&lt;/h3&gt;
&lt;p&gt;If you are assuming a role in another account that was created with an external ID, then specify the external ID in this field. 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;endpoint&#34;&gt;Endpoint&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;Endpoint&lt;/code&gt; field allows you to specify a custom endpoint URL that overrides the default generated endpoint for the AWS service API. Leave this field blank if you want to use the default generated endpoint. For more information on why and how to use 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;aws-credentials-file&#34;&gt;AWS credentials file&lt;/h2&gt;
&lt;p&gt;Create a file at &lt;code&gt;~/.aws/credentials&lt;/code&gt;. That is the &lt;code&gt;HOME&lt;/code&gt; path for user running grafana-server.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you think you have the credentials file in the right place and it is still not working, you might try moving your .aws file to &amp;lsquo;/usr/share/grafana/&amp;rsquo; and make sure your credentials file has at most 0644 permissions.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Example content:&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;eks-iam-roles-for-service-accounts&#34;&gt;EKS IAM roles for service accounts&lt;/h2&gt;
&lt;p&gt;The Grafana process in the container runs as user 472 (called &amp;ldquo;grafana&amp;rdquo;). When Kubernetes mounts your projected credentials, they will by default only be available to the root user. To allow user 472 to access the credentials (and avoid falling back to the IAM role attached to the EC2 instance), you need to provide 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;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;
]]></content><description>&lt;h1 id="aws-authentication">AWS authentication&lt;/h1>
&lt;p>Requests from a Grafana plugin to AWS are made on behalf of an IAM role or an IAM user. The IAM user or IAM role must have the associated policies to perform certain API actions. Since these policies are specific to each data source, refer to the data source documentation for details.&lt;/p></description></item><item><title>Template variables in CloudWatch query</title><link>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/template-queries-cloudwatch/</link><pubDate>Sat, 04 Apr 2026 12:26:57 +0000</pubDate><guid>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/template-queries-cloudwatch/</guid><content><![CDATA[&lt;h1 id=&#34;using-template-variables-in-cloudwatch-queries&#34;&gt;Using template variables in CloudWatch queries&lt;/h1&gt;
&lt;p&gt;Instead of hard-coding server, application, and sensor names in your metric queries, you can use variables. The variables are listed as dropdown select boxes at the top of the dashboard. These dropdowns make it easy to change the display of data in your dashboard.&lt;/p&gt;
&lt;p&gt;For an introduction to templating and template variables, refer to the &lt;a href=&#34;../../../variables/&#34;&gt;Templating&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h2 id=&#34;query-variable&#34;&gt;Query variable&lt;/h2&gt;
&lt;p&gt;The CloudWatch data source provides the following queries that you can specify in the &lt;code&gt;Query&lt;/code&gt; field in the Variable edit view. They allow you to fill a variable&amp;rsquo;s options list with things like &lt;code&gt;region&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;p&gt;In place of &lt;code&gt;region&lt;/code&gt; you can specify &lt;code&gt;default&lt;/code&gt; to use the default region configured in the data source for the query,
e.g. &lt;code&gt;metrics(AWS/DynamoDB, default)&lt;/code&gt; or &lt;code&gt;dimension_values(default, ..., ..., ...)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Read more about the available dimensions in 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;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;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;regions()&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of all AWS regions&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;namespaces()&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of namespaces CloudWatch support.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;metrics(namespace, [region])&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of 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;code&gt;dimension_keys(namespace)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of dimension keys in the namespace.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;dimension_values(region, namespace, metric, dimension_key, [filters])&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of 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;, &lt;code&gt;dimension_key&lt;/code&gt; or you can use dimension &lt;code&gt;filters&lt;/code&gt; to get more specific result as well.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ebs_volume_ids(region, instance_id)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of volume ids matching the specified &lt;code&gt;region&lt;/code&gt;, &lt;code&gt;instance_id&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ec2_instance_attribute(region, attribute_name, filters)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of attributes matching the specified &lt;code&gt;region&lt;/code&gt;, &lt;code&gt;attribute_name&lt;/code&gt;, &lt;code&gt;filters&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;resource_arns(region, resource_type, tags)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of 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;code&gt;statistics()&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Returns a list of all the standard statistics&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;For details about the metrics CloudWatch provides, please 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;h2 id=&#34;example-of-templated-queries&#34;&gt;Example of templated queries&lt;/h2&gt;
&lt;p&gt;Here is an example of the dimension queries which will return list of resources for individual AWS Services:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Query&lt;/th&gt;
              &lt;th&gt;Service&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;dimension_values(us-east-1,AWS/ELB,RequestCount,LoadBalancerName)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;ELB&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;dimension_values(us-east-1,AWS/ElastiCache,CPUUtilization,CacheClusterId)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;ElastiCache&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;dimension_values(us-east-1,AWS/Redshift,CPUUtilization,ClusterIdentifier)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;RedShift&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;dimension_values(us-east-1,AWS/RDS,CPUUtilization,DBInstanceIdentifier)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;RDS&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;dimension_values(us-east-1,AWS/S3,BucketSizeBytes,BucketName)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;S3&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;dimension_values(us-east-1,CWAgent,disk_used_percent,device,{&amp;quot;InstanceId&amp;quot;:&amp;quot;$instance_id&amp;quot;})&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;CloudWatch Agent&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;resource_arns(eu-west-1,elasticloadbalancing:loadbalancer,{&amp;quot;elasticbeanstalk:environment-name&amp;quot;:[&amp;quot;myApp-dev&amp;quot;,&amp;quot;myApp-prod&amp;quot;]})&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;ELB&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;resource_arns(eu-west-1,elasticloadbalancing:loadbalancer,{&amp;quot;Component&amp;quot;:[&amp;quot;$service&amp;quot;],&amp;quot;Environment&amp;quot;:[&amp;quot;$environment&amp;quot;]})&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;ELB&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;resource_arns(eu-west-1,ec2:instance,{&amp;quot;elasticbeanstalk:environment-name&amp;quot;:[&amp;quot;myApp-dev&amp;quot;,&amp;quot;myApp-prod&amp;quot;]})&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;EC2&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;using-json-format-template-variables&#34;&gt;Using JSON format template variables&lt;/h2&gt;
&lt;p&gt;Some queries accept filters in JSON format and Grafana supports the conversion of template variables to JSON.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;env = &#39;production&#39;, &#39;staging&#39;&lt;/code&gt;, following query will return ARNs of EC2 instances which &lt;code&gt;Environment&lt;/code&gt; tag is &lt;code&gt;production&lt;/code&gt; or &lt;code&gt;staging&lt;/code&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;JavaScript&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-javascript&#34;&gt;resource_arns(us-east-1, ec2:instance, {&amp;#34;Environment&amp;#34;:${env:json}})&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;ec2_instance_attribute-examples&#34;&gt;ec2_instance_attribute examples&lt;/h2&gt;
&lt;h3 id=&#34;json-filters&#34;&gt;JSON filters&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;ec2_instance_attribute&lt;/code&gt; query takes &lt;code&gt;filters&lt;/code&gt; in JSON format.
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;.
Note that the actual filtering takes place on Amazon&amp;rsquo;s servers, not in Grafana.&lt;/p&gt;
&lt;p&gt;Filters 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;JavaScript&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-javascript&#34;&gt;{ &amp;#34;filter_name1&amp;#34;: [ &amp;#34;filter_value1&amp;#34; ], &amp;#34;filter_name2&amp;#34;: [ &amp;#34;filter_value2&amp;#34; ] }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Example &lt;code&gt;ec2_instance_attribute()&lt;/code&gt; query&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;JavaScript&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-javascript&#34;&gt;ec2_instance_attribute(us - east - 1, InstanceId, { &amp;#39;tag:Environment&amp;#39;: [&amp;#39;production&amp;#39;] });&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;selecting-attributes&#34;&gt;Selecting attributes&lt;/h3&gt;
&lt;p&gt;Only 1 attribute per instance can be returned. Any flat attribute can be selected (i.e. if the attribute has a single value and isn&amp;rsquo;t an object or array). Below is a list of available flat attributes:&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;Tags can be selected by prepending the tag name with &lt;code&gt;Tags.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Example &lt;code&gt;ec2_instance_attribute()&lt;/code&gt; query&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;JavaScript&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-javascript&#34;&gt;ec2_instance_attribute(us - east - 1, Tags.Name, { &amp;#39;tag:Team&amp;#39;: [&amp;#39;sysops&amp;#39;] });&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="using-template-variables-in-cloudwatch-queries">Using template variables in CloudWatch queries&lt;/h1>
&lt;p>Instead of hard-coding server, application, and sensor names in your metric queries, you can use variables. The variables are listed as dropdown select boxes at the top of the dashboard. These dropdowns make it easy to change the display of data in your dashboard.&lt;/p></description></item><item><title>Curated CloudWatch dashboards</title><link>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/preconfig-cloudwatch-dashboards/</link><pubDate>Sat, 04 Apr 2026 12:26:57 +0000</pubDate><guid>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/preconfig-cloudwatch-dashboards/</guid><content><![CDATA[&lt;h1 id=&#34;curated-cloudwatch-dashboards&#34;&gt;Curated CloudWatch dashboards&lt;/h1&gt;
&lt;p&gt;The updated CloudWatch data source ships with pre-configured dashboards for five of the most popular AWS services:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Amazon Elastic Compute Cloud &lt;code&gt;Amazon EC2&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;Amazon Elastic Block Store &lt;code&gt;Amazon EBS&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;AWS Lambda &lt;code&gt;AWS Lambda&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;Amazon CloudWatch Logs &lt;code&gt;Amazon CloudWatch Logs&lt;/code&gt;, and&lt;/li&gt;
&lt;li&gt;Amazon Relational Database Service &lt;code&gt;Amazon RDS&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To import curatedd dashboards:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;On the configuration page of your CloudWatch data source, click the &lt;strong&gt;Dashboards&lt;/strong&gt; tab.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Import&lt;/strong&gt; for the dashboard you would like to use.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In case you want to customize a dashboard, we recommend that you save it under a different name. Otherwise the dashboard will be overwritten when a new version of the dashboard is released.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p &#34;
    style=&#34;max-width: 1020px;&#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/v65/cloudwatch-dashboard-import.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/v65/cloudwatch-dashboard-import.png&#34;data-srcset=&#34;/static/img/docs/v65/cloudwatch-dashboard-import.png?w=320 320w, /static/img/docs/v65/cloudwatch-dashboard-import.png?w=550 550w, /static/img/docs/v65/cloudwatch-dashboard-import.png?w=750 750w, /static/img/docs/v65/cloudwatch-dashboard-import.png?w=900 900w, /static/img/docs/v65/cloudwatch-dashboard-import.png?w=1040 1040w, /static/img/docs/v65/cloudwatch-dashboard-import.png?w=1240 1240w, /static/img/docs/v65/cloudwatch-dashboard-import.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;CloudWatch dashboard import&#34;width=&#34;1020&#34;height=&#34;470&#34;title=&#34;CloudWatch dashboard import&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/static/img/docs/v65/cloudwatch-dashboard-import.png&#34;
            alt=&#34;CloudWatch dashboard import&#34;width=&#34;1020&#34;height=&#34;470&#34;title=&#34;CloudWatch dashboard import&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13  &#34;&gt;CloudWatch dashboard import&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
]]></content><description>&lt;h1 id="curated-cloudwatch-dashboards">Curated CloudWatch dashboards&lt;/h1>
&lt;p>The updated CloudWatch data source ships with pre-configured dashboards for five of the most popular AWS services:&lt;/p>
&lt;ul>
&lt;li>Amazon Elastic Compute Cloud &lt;code>Amazon EC2&lt;/code>,&lt;/li>
&lt;li>Amazon Elastic Block Store &lt;code>Amazon EBS&lt;/code>,&lt;/li>
&lt;li>AWS Lambda &lt;code>AWS Lambda&lt;/code>,&lt;/li>
&lt;li>Amazon CloudWatch Logs &lt;code>Amazon CloudWatch Logs&lt;/code>, and&lt;/li>
&lt;li>Amazon Relational Database Service &lt;code>Amazon RDS&lt;/code>.&lt;/li>
&lt;/ul>
&lt;p>To import curatedd dashboards:&lt;/p></description></item><item><title>Provision CloudWatch</title><link>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/provision-cloudwatch/</link><pubDate>Sat, 04 Apr 2026 12:26:57 +0000</pubDate><guid>https://grafana.com/docs/grafana/v8.4/datasources/aws-cloudwatch/provision-cloudwatch/</guid><content><![CDATA[&lt;h1 id=&#34;provision-cloudwatch-data-source&#34;&gt;Provision CloudWatch data source&lt;/h1&gt;
&lt;p&gt;You can configure the CloudWatch data source by customizing configuration files in Grafana&amp;rsquo;s provisioning system. To know more about provisioning and learn about available configuration options, refer to the &lt;a href=&#34;../../../administration/provisioning/#datasources&#34;&gt;Provisioning Grafana&lt;/a&gt; topic.&lt;/p&gt;
&lt;p&gt;Here are some provisioning examples for this data source.&lt;/p&gt;
&lt;h2 id=&#34;using-aws-sdk-default&#34;&gt;Using AWS SDK (default)&lt;/h2&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;h2 id=&#34;using-credentials-profile-name-non-default&#34;&gt;Using credentials&amp;rsquo; profile name (non-default)&lt;/h2&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;h2 id=&#34;using-accesskey-and-secretkey&#34;&gt;Using accessKey and secretKey&lt;/h2&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;h2 id=&#34;using-aws-sdk-default-and-arn-of-iam-role-to-assume&#34;&gt;Using AWS SDK Default and ARN of IAM Role to Assume&lt;/h2&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="provision-cloudwatch-data-source">Provision CloudWatch data source&lt;/h1>
&lt;p>You can configure the CloudWatch data source by customizing configuration files in Grafana&amp;rsquo;s provisioning system. To know more about provisioning and learn about available configuration options, refer to the &lt;a href="../../../administration/provisioning/#datasources">Provisioning Grafana&lt;/a> topic.&lt;/p></description></item></channel></rss>