How do I stop cloud-init from overwriting my hostname on AWS (CentOS)
<p>I have a script that runs at boot (via rc.local) and sets my hostname based on the instance name it queries from the AWS CLI. It works, and at the end of the boot log it says " login:"</p>

<p>At figured that cloud-init was overwriting my hostname, so I: </p>

<ul>
<li>set preserve_hostname: true in /etc/cloud/cloud.cfg</li>
<li>commented out set-hostname and update-hostname in the cloud_config_modules section of /etc/cloud/cloud.cfg.d/00_defaults.cfg</li>
</ul>

<p>But in the cloud-init logs I still see "Running module update-hostname" and " Migrated semaphore update_hostname.always to config-update-hostname with frequency always", and a minute or two after boot the hostname returns to the AWS default.</p>

<p>What is going on? How do I stop it?</p>