How can I change the EC2 hostname?
To change the hostname on an Amazon EC2 Linux instance and ensure it persists across reboots, you need to configure
cloud-init to stop overwriting it, apply the new name via hostnamectl, and update your local hosts file.