Tag your Amazon EC2 instances

Create dynamic tag rules to tag your EC2 instances based on EC2 metadata as collected by the EC2 Connector. For each tag rule you’ll provide a search query with EC2 instance information.

It's easy to get started! 1) Click Create Tag, 2) choose Dynamic tag type,  3) choose the Cloud Asset Search tag rule, 4) choose AWS (EC2) cloud provider and 5) enter your query. Just start typing in the Query field and we’ll show you the EC2 attributes you can search.

New tag rule.

 

Good to Know The syntax is different when writing queries for tag rules than when searching assets in the Assets list. Be sure to follow the syntax tips in the drop-down when writing your query.

Sample queries

Find running EC2 instances:

aws.ec2.instanceState:"RUNNING"

Find EC2 instances with type "t2.medium" in the region "US West (Northern California)":

aws.ec2.instanceType:"t2.medium" and aws.ec2.region.name:"US West (Northern California)"

Find EC2 instances with AWS tag key "department" and value "stage":

aws.tags.key:department and aws.tags.value:stage

Find EC2 instances created from pre-approved AMIs (ami-1231231 and ami-8790707):

aws.ec2.imageId:ami-1231231 and aws.ec2.imageId:ami-8970707

Find EC2 instances with specific criteria for scanning:

aws.ec2.region.name:"EU (London)" and aws.ec2.vpcId: [vpc-12321213, vpc-342342] and aws.ec2.instanceState:"RUNNING"

Find EC2 instances based on IPs (comma-separated list or range):

aws.ec2.privateIpAddress:[10.18.25.100, 10.18.26.250, 10.18.25.100]
aws.ec2.privateIpAddress:[10.18.25.100 ... 10.18.25.200]