Hostname resets on restart on Amazon Web Services Print

  • 0

Symptoms

On Amazon Web Services, the system hostname is changed upon a reboot of the server. This can cause license errors.

 

Procedure

On AWS servers, you must utilize the Cloud Config system. The configuration files are located in:

/etc/cloud/cloud.cfg.d/

In some cases, there may already be a 99_hostname.cfg file in place which is setting the hostname. You can verify if the file exists by listing the directory contents.

 

ls -lah /etc/cloud/cloud.cfg.d/

If the file does not exist, it must be created.

 

touch /etc/cloud/cloud.cfg.d/99_hostname.cfg

Then, the file must be edited.

 

nano /etc/cloud/cloud.cfg.d/99_hostname.cfg

You will want to modify the "hostname" and "fqdn" configurations:

#cloud-config
hostname: server
fqdn: server.domain.tld

Note: You will want to replace "server.domain.tld" with the full hostname of your server and "server" with just the last segment of that hostname in the above example.


Was this answer helpful?
Back