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 New Tag, 2) choose the Cloud Asset Search tag rule, and 3) enter your query. Just start typing in the Query field and we’ll show you the EC2 attributes you can search.
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.
Find running EC2 instances:
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]
Use the search fields that start with aws.ec2. Note - Your results may return Terminated instances. It's recommended you include aws.ec2instanceState in your query to reduce the number of results.