Created
September 4, 2018 06:50
-
-
Save yuya-takeyama/c02ce697cf1d56521716b0fbfea1701e to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
ip_map=$(jq --raw-input . | jq --slurp . | jq 'to_entries | map({key: .value, value: true}) | from_entries' --compact-output) | |
aws --profile aya ec2 describe-instances | \ | |
jq -r --argjson ipMap "${ip_map}" \ | |
'.Reservations[].Instances[] | select(.PrivateIpAddress | in($ipMap)) | .InstanceId' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment