Query AWS CLI to get Instance Name and Instance Type

Remove Grep if you want to list or keep it for search and example here search by name with ‘db’


aws ec2 describe-instances  --region eu-west-1 --query 'Reservations[*].Instances[*].[Placement.AvailabilityZone, State.Name, InstanceId,InstanceType,Tags[?Key==`Name`] | [0].Value]' --output text |grep db
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s