Last active
August 28, 2021 05:19
-
-
Save jweyrich/e134c92b7045c6322845bb37e7ea7a15 to your computer and use it in GitHub Desktop.
List instances attributes using AWS CLI and JQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROFILE=default | |
REGION=us-east-1 | |
aws --profile=$PROFILE --region=$REGION --output=text ec2 describe-instances \ | |
--query "Reservations[*].Instances[*].[InstanceType, State.Name, Platform, Tags[?Key=='Name']]" | |
aws --profile=$PROFILE --region=$REGION --output=json ec2 describe-instances \ | |
| jq '.Reservations[].Instances[] | "\(.InstanceType); \(.State.Name); \(.Platform); \(.Tags[]//[]|select(.Key=="Name")|.Value)"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment