You can set the hostname of the host using cloud-config. The example below shows how to configure it.
#cloud-config hostname: myhost