Skip to content

Instantly share code, notes, and snippets.

@SavvyGuard
Created August 14, 2013 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SavvyGuard/6226866 to your computer and use it in GitHub Desktop.
Save SavvyGuard/6226866 to your computer and use it in GitHub Desktop.
get the current EC2 instance's public host name. Easily changed to get private hostname and other info.
import boto.utils
print boto.utils.get_instance_metadata()['network']['interfaces']['macs'].values()[0]['public-hostname']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment