While I’d normally use “hostnamectl set-hostname ” to modify the hostname of a Linux box, that doesn’t work for Ubuntu 18.04. The hostname will remain unchanged. Instead, modify as follows.
In /etc/cloud/cloud.cfg, modify “preserve_hostname” from “false” to “true”:
vi /etc/cloud/cloud.cfg
Modify hostname to the value you want in /etc/hostname:
vi /etc/hostname
Reboot