Change Hostname on RHEL 7.x for SAP Installations on AWS

SAP systems require hostnames which aren't longer than 13 characters. The default AWS naming schema is to use the IP address separated with dashes to create hostnames. This naming schema can lead to host names with are to long for SAP installations.

The fix is based on the following assumptions:

  • The SAP system is being operated in a VPC with it's network interface
  • The IP address is a private one.
  • No DNS or NIS naming in the clients have to be used

The following procedure renames a system to node1

RHEL 7.x

  1. Change the content of file /etc/HOSTNAME to node1. This entry will be used to set the host name for future reboots
  2. Edit the file /etc/cloud/cloud.cfg
    1. Add the line preserve_hostname: true at the beginning. This entry will be used in the next reboot to determine whether the hostname should be left as it is.
  3. Edit the file /etc/hosts
    1. Add node1 to the primary IP address like in this example " ip-10-79-7-92 node1"
  4. Set the host name with the command "$ hostname node1". This command performs a dynamic change. It's effect will not last beyond a reboot.