Assigning Static HostName to EC2 Instances
Hi Friends, Below are the Steps to assign a Static hostname to EC2 Instances: Open the cloud.cfg file located at vi /etc/cloud/cloud.cfg Edit the file with the parameter preserve_hostname: true at the end of the file. Open the hostname file(vi /etc/hostname) and delete the existing hostname and enter a new hostname you desired. Open the hosts file(vi /etc/hosts) and add the entry with the current IP address and above entered new hostname. To reflect the changes, one must run the init 6 command and re-login to the session. Now, we can see that hostname is changed successfully.