Created
May 6, 2020 20:47
-
-
Save sharuzzaman/7df2e14d4d0dd313deb791040c59496f to your computer and use it in GitHub Desktop.
Get a list of EC2 instances that is currently running, and sort its output by name
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 --filters "Name=instance-state-name,Values=running" | jq '.Reservations[]|.Instances[]|{InstanceId,PrivateIpAddress,Name: .Tags[]|select(.Key == "Name").Value}' | jq -n '[inputs]|sort_by(.Name)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment