Skip to content

Instantly share code, notes, and snippets.

@fluxrad
Created November 6, 2014 22:08
Show Gist options
  • Save fluxrad/7ec6b573e9f496d2fffe to your computer and use it in GitHub Desktop.
Save fluxrad/7ec6b573e9f496d2fffe to your computer and use it in GitHub Desktop.
Update hostname on an AWS instance
# Fix an EC2 instance's hostname.
echo "ip-$(echo $(curl -s http://169.254.169.254/latest/meta-data/local-ipv4 | tr '.' '-'))" | sudo tee /etc/hostname | sudo xargs hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment