change hostname amazon linux
Here’s how to make a hostname stick on Amazon Linux.
Set preserve_hostname to true in /etc/cloud/cloud.cfg.
preserve_hostname: true
Set the hostname in /etc/sysconfig/network.
HOSTNAME=server.domain.com
NETWORKING=yes
NOZEROCONF=yes
Reboot the server to make sure hostname sticks after a reboot.
shutdown -r now
Login to confirm hostname sticks.