Skip to content

Instantly share code, notes, and snippets.

@orimanabu
Created October 15, 2019 13:33
Show Gist options
  • Save orimanabu/f78b90d710d836d555d8e14c0e1bff9d to your computer and use it in GitHub Desktop.
Save orimanabu/f78b90d710d836d555d8e14c0e1bff9d to your computer and use it in GitHub Desktop.
Convert OpenShift4 internal hostname to AWS node tag
#!/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