• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

AWS CLI: Describe Instances

December 13, 2018

If you have a ton of EC2 instances, one way to get results quickly is to run to use AWS CLI such as “describe-instances.” Here’s an example on how to get a list of instances with a tag name equal to some value. In addition, you limit the display only results you want displayed.

$ aws ec2 describe-instances \
--query 'Reservations[].Instances[].Tags[?Key==`Name`].Value' \
--filter Name=tag:Project,Values=web \
--region us-east-1 \
--profile default \
--output text

$ aws ec2 describe-instances \ --query 'Reservations[].Instances[].Tags[?Key==`Name`].Value' \ --filter Name=tag:Project,Values=web \ --region us-east-1 \ --profile default \ --output text

This returns values of the “Name” tag name in instances where they occur.

Filed Under: Cloud Tagged With: aws cli, describe instances, ec2, filter, query, tags

Search This Website

Subscribe Via Email

  • Home
  • About
  • Archives

Copyright © 2023