Created
September 24, 2019 16:56
-
-
Save dbt4u/5284278f952ee67d28e05f6820731663 to your computer and use it in GitHub Desktop.
Counts all EC2 Instances grouped by Type and State
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
aws ec2 describe-instances | jq -r "[[.Reservations[].Instances[]|{ state: .State.Name, type: .InstanceType }]|group_by(.state)|.[]|{state: .[0].state, types: [.[].type]|[group_by(.)|.[]|{type: .[0], count: ([.[]]|length)}] }]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment