Last active
May 19, 2020 09:23
-
-
Save sharuzzaman/af3131a874ab4262a825d0ae0173954b to your computer and use it in GitHub Desktop.
Get a list of devices for each running EC2 instances sorted by name
This file contains 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 --filters "Name=instance-state-name,Values=running" | jq '[.Reservations[]|.Instances[]|{Name: .Tags[]|select(.Key == "Name").Value,DeviceName: [.BlockDeviceMappings[]|.DeviceName]}]|sort_by(.Name)' ec2.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment