Change the hostname on your EC2 Server Instance

Last updated:

To change the name of one of your Amazon EC2 Instances (assumed Ubuntu) from something like DomU-12-31-38-00-AA-11 to something more readable like app_server or git_server or something like that (so you can tell just by looking at the terminal window title which one is which), do this:

add this line to /etc/hosts: newservername

add this line to /etc/hostname


then type this:

sudo hostname newservername

then reboot yer machine!

sudo reboot

and, of course, replace newservername with your server's new name.

Dialogue & Discussion