Created
October 20, 2016 16:06
-
-
Save jillesvangurp/fb8ee1fce482846ab12cb0c37a3a1b4f to your computer and use it in GitHub Desktop.
jq expression to get a csv out of aws describe-instances
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
# we have Name tags and environment_name tags so it makes sense to add those as columns | |
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" | jq --raw-output '.Reservations[].Instances[] | [.Placement.AvailabilityZone, .PrivateDnsName, .InstanceType, (.Tags[] | select(.Key == "Name").Value),(.Tags[] | select(.Key == "environment_name").Value)] | @csv' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment