Skip to main content

AWS EC2: hostname reverts to xxxxxx.ec2.internal on boot. Is it a problem?

Comments

3 comments

  • cPanelMichael
    Hello, Amazon offers instructions on this at: Changing the Hostname of Your Linux Instance - Amazon Elastic Compute Cloud To confirm, did these instructions fail after rebooting the system? If so, have you consulted with Amazon's support to determine why their instructions are not working as intended? Thank you.
    0
  • pandalion98
    The weird hostname was causing havoc on the mail system. Therefore, ignoring the hostname is NOT okay. However, it has been resolved in a recent ticket. Here's what he instructed me to do: Looking at the instructions for CentOS 7 for AWS, it looks like you also need to update the /etc/cloud/cloud.cfg file to preserve the hostname. This is that section. Update the /etc/cloud/cloud.cfg file on your RHEL 7 or Centos 7 Linux instance.
    sudo vim /etc/cloud/cloud.cfg
    Append the following string at the bottom of the file to ensure that the hostname is preserved between restarts/reboots.
    preserve_hostname: true
    Save and exit the vim editor. This page shows all of the steps that you need to take to do that on CentOS 7. Amazon EC2 Linux Static Hostname RHEL7 Centos7
    And the hostname doesn't change now.
    0
  • cPanelMichael
    I'm happy to see the issue is now resolved. Thank you for updating us with the outcome.
    0

Please sign in to leave a comment.