Translates an AWS instance ID to the private DNS 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
function id2dns() { | |
if [ -z "$1" ]; then | |
echo "Usage: id2ip instanceID [instanceID...]" | |
else | |
aws ec2 describe-instances --instance-ids $* --output text --query 'Reservations[].Instances[].PrivateDnsName' | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires:
the jq commandUpdate 2020-08-14: jq not needed any more, using the
--output text
and--query
is just as fine, and doesn't need an additional software :-)