Skip to content

Instantly share code, notes, and snippets.

@brontolinux

brontolinux/id2dns.sh Secret

Last active Aug 14, 2020
Embed
What would you like to do?
Translates an AWS instance ID to the private DNS name
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
}
@brontolinux

This comment has been minimized.

Copy link
Owner Author

@brontolinux brontolinux commented Aug 13, 2020

Requires:

  • the AWS CLI
  • the jq command
  • valid AWS credentials set in the shell

Update 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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.