Created
October 15, 2019 13:33
-
-
Save orimanabu/f78b90d710d836d555d8e14c0e1bff9d to your computer and use it in GitHub Desktop.
Convert OpenShift4 internal hostname to AWS node tag
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
#!/bin/bash | |
if [ x"$#" != x"1" ]; then | |
echo "$0 hostname" | |
exit 1 | |
fi | |
hostname=$1; shift | |
json=$(aws ec2 describe-instances) | |
echo "${json}" | jq -r '.Reservations[].Instances[] | select(.PrivateDnsName == "'${hostname}'") | .Tags | from_entries | .Name' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment