Wednesday, December 15, 2021

Set hostname in AWS EC2

  cat << EOD >> /etc/cloud/cloud.cfg.d/99_hostname.cfg

 #cloud-config

hostname: my-node2

fqdn: my-node2.mydomain.com

EOD


## in case of selinux enabled:

cd /etc/cloud/cloud.cfg.d/

chown root: 99_hostname.cfg

chmod 644 99_hostname.cfg

chcon system_u:object_r:etc_t:s0 99_hostname.cfg


# reboot


No comments:

Post a Comment