I have questions related to the host name in Ubuntu EC2 instances. I have a IPS elastics for hosts that want to be seen from the internet and I have pointed out in the DNS entries with the computer name to those ips. For example, for elastic IP DNS I added my computer name www.example.com.

But I also want to rename the machines which they have, because it is a parameter of the service running on them (ejabberd server). EC2 instances are restarted when changing the host name, and seen on the client requesting dhcp hostname to dhcp Amazon.

My question is ... What is the safest method to change the hostname: dhcp client modify, insert the command in rc.local, etc. ..? Could I have a problem with the internal resolution of traffic between EC2 instances?


  • Mainly I worry if I change the hostname is like going to affect the internal traffic between EC2 instances. That is, if I change the hostname of ip-xxxx to www.example.com ubuntu on my machine, when another machine ec2 www.example.com wants to address, this entry does not exist in the dns of AWS and therefore not communicate. Or in the DNS entry is related to the instance name and this name is the one to ask the other instance ec2? Note: -> The question arises from the cluster configuration of different machines for ejabberd (XMPP server) – aelbaz Sep 11 '12 at 22:34

Changing your hostname should not affect your internal IP nor how your EC2 internal traffic is routed.

I'm not sure what AMI you're using, but ubuntu apparently says that changing the hostname on their public cloud AMIs via the usual linux tools (/bin/hostname, /etc/hostname) is the recommended way and thus should not affect your internal AWS traffic routing.


(the responder's profile in that thread states "Occupation Ubuntu Cloud Community Manager", so it looks to me like this is officially supported.)

There is also a thread here that outlines some of the problems that can happen when changing your hostname such as errors like 'unable to lookup via gethostbyname()':


I've been using the Ubuntu Public AMIs as base AMIs and haven't yet had any problems caused by changing the hostnames locally on the instances via /bin/hostname and writing to /etc/hostname. Good question though. I actually never thought about it before. I just tried it and it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.