I have setup an Ubuntu 8.10 server instance on Amazon EC2. I install ejabberd on server, but I face some problems on ejabberd node can't start because hostname on cloud changes each time we relaunch the instance. After I follow this link http://blog.kenweiner.com/2008/05/ejabberd-on-amazon-ec2-ubuntu-ami.html to edit and add hostname in /etc/hosts file, it works. Unfortunately, every time I reboot the server, the /etc/hosts file get reset to default.

How could I solve this problem?

  • I'm running Ubuntu (desktop) 10.10 on my laptop and the problem with the /etc/hosts files persists. It's reseted any time I reboot. Googling for a solution I just found this thread. No luck at this moment. :( – Bilbo Jan 28 '11 at 14:37

This is a known problem with the current Ubuntu images for EC2 built by Canonical:

https:// bugs.launchpad.net/ubuntu-on-ec2/+bug/371936

You can wait for the next release from Canonical or run the Ubuntu images for EC2 which I publish on http:// alestic.com (and which do not have the same problem).

I have successfully run ejabberd on the Alestic.com images.


I know this a super old thread but one the pops up on ggl, yes it is cloud-init, on my debian ami I added my custom entries in:


lets see if that works on next auto-reboot by

aws ec2 create-ami ...

You could try CloudInit to perform your hosts file cleanup during instance boot. It is included in all the current official Ubuntu EC2 images and allows you to run initialization scripts passed by the --user-data switch of ec2-run-instances (or the respective input field(s) in the AWS Console wizard) which will be run at boot. Kind of like rc.local.

Edit: I did not realize it was Eric himself who wrote the other comment, at first. He's got lots of useful entries in his blog at Alestic, including one regarding the mentioned UserData.

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.