Files
Garrett Guillotte 852d069a3c Docs: Refactor data sources content (#57573)
* Docs: Revise data source index

* Docs: Consolidate data source administration docs

* Docs: Revise panels docs related to data sources

* Docs: Revise Alertmanager data source

* Docs: Reorganize AWS CloudWatch data source docs

* Docs: Reorganize Azure Monitor data source docs

* Docs: Move azuremonitor to azure-monitor

* Docs: Revise Elasticsearch docs

* Docs: Move Elasticsearch index into bundle

* Docs: Revise GCM docs

* Docs: Revise Graphite docs

* Docs: Move Graphite index into bundle

* Docs: Revise InfluxDB docs

* Docs: Revise Jaeger docs

* Docs: Move Jaeger index into bundle

* Docs: Revise Loki docs

* Docs: Move Loki index into bundle

* Docs: Revise MS SQL docs

* Docs: Move MS SQL index into bundle

* Docs: Revise Prometheus docs

* Docs: Move Prometheus index into bundle

* Docs: Revise Tempo docs

* Docs: Move Tempo index into bundle

* Docs: Revise TestData DB docs

* Docs: Move TestData DB index into bundle

* Docs: Revise Zipkin docs

* Docs: Move Zipkin index into bundle

* Docs: Move other data sources' index pages into bundles

* Docs: Revise frontmatter

* Fixing hugo markdown errors

* Docs: Add query editor and template var sections to overview doc

* Docs: Remove CTAs across data source docs

* Docs: Remove CTA

* Docs: Remove CTA

* Docs: Fix links, images, typos, and usage consistency.

* Docs: Fix typos

* Docs: Fix CI issues

* Update docs/sources/datasources/_index.md

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

* Update docs/sources/datasources/_index.md

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

* Docs: Fix query editor links

* Update docs/sources/panels-visualizations/_index.md

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

* Update docs/sources/panels-visualizations/_index.md

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

* Docs: Rebundle child pages per writers' toolkit

* Docs: Fix prettier for CI

* Docs: Fix relrefs from outside data sources docs

* Docs: Fix broken relrefs within datasources

* Docs: Fix relrefs to data sources docs

* Fixed some more refs

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2022-11-01 10:22:06 -05:00

5.0 KiB

aliases description keywords menuTitle title weight
/docs/grafana/latest/datasources/aws-cloudwatch/template-queries-cloudwatch/
/docs/grafana/latest/data-sources/aws-cloudwatch/template-variables/
Guide on using template variables in CloudWatch queries
grafana
aws
cloudwatch
templates
variables
Template variables CloudWatch template variables 400

CloudWatch template variables

Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed in your dashboard. Grafana refers to such variables as template variables.

For an introduction to templating and template variables, refer to the [Templating]({{< relref "../../../dashboards/variables" >}}) and [Add and manage variables]({{< relref "../../../dashboards/variables/add-template-variables" >}}) documentation.

Use query variables

You can specify these CloudWatch data source queries in the Variable edit view's Query Type field. Use them to fill a variable's options list with values like regions, namespaces, metric names, and dimension keys/values.

Name List returned
Regions All AWS regions.
Namespaces All namespaces CloudWatch supports.
Metrics Metrics in the namespace. (Specify region or use "default" for custom metrics.)
Dimension Keys Dimension keys in the namespace.
Dimension Values Dimension values matching the specified region, namespace, metric, and dimension_key. Use dimension filters for more specific results.
EBS Volume IDs Volume ids matching the specified region and instance_id.
EC2 Instance Attributes Attributes matching the specified region, attribute_name, and filters.
Resource ARNs ARNs matching the specified region, resource_type, and tags.
Statistics All standard statistics.
LogGroups All log groups matching the specified region.

For details on the available dimensions, refer to the CloudWatch Metrics and Dimensions Reference.

For details about the metrics CloudWatch provides, refer to the CloudWatch documentation.

Use variables in queries

Use Grafana's variable syntax to include variables in queries. For details, refer to the [variable syntax documentation]({{< relref "../../../dashboards/variables/variable-syntax" >}}).

Use ec2_instance_attribute

Filters

The ec2_instance_attribute query takes filters as a filter name and a comma-separated list of values. You can specify pre-defined filters of ec2:DescribeInstances.

Select attributes

A query returns only one attribute per instance. You can select any attribute that has a single value and isn't an object or array, also known as a flat attribute:

  • AmiLaunchIndex
  • Architecture
  • ClientToken
  • EbsOptimized
  • EnaSupport
  • Hypervisor
  • IamInstanceProfile
  • ImageId
  • InstanceId
  • InstanceLifecycle
  • InstanceType
  • KernelId
  • KeyName
  • LaunchTime
  • Platform
  • PrivateDnsName
  • PrivateIpAddress
  • PublicDnsName
  • PublicIpAddress
  • RamdiskId
  • RootDeviceName
  • RootDeviceType
  • SourceDestCheck
  • SpotInstanceRequestId
  • SriovNetSupport
  • SubnetId
  • VirtualizationType
  • VpcId

You can select tags by prepending the tag name with Tags.. For example, select the tag Name by using Tags.Name.