Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Using ec2_instance_attribute examples

Focus mode
Using ec2_instance_attribute examples - Amazon Managed Grafana

JSON filters

The ec2_instance_attribute query takes filters in JSON format. You can specify pre-defined filters of ec2:DescribeInstances. Note that the actual filtering takes place in AWS, not in Grafana.

The following code example shows the filters syntax.

{ filter_name1: [ filter_value1 ], filter_name2: [ filter_value2 ] }

The following example shows the ec2_instance_attribute() query.

ec2_instance_attribute(us - east - 1, InstanceId, { 'tag:Environment': ['production'] });

Selecting attributes

Only one attribute per instance can be returned. Any flat attribute can be selected (that is, if the attribute has a single value and isn’t an object or array). The following flat attributes are available.

  • 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

Tags can be selected by prefixing the tag name with Tags.

The following example shows the ec2_instance_attribute() query.

ec2_instance_attribute(us - east - 1, Tags.Name, { 'tag:Team': ['sysops'] });

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.