I've got a private DNS Server running on Amazon EC2. I don't need a public IP Address because its only used for private addressing web1.xxx.internal database1.xxx.internal

Problem is I had to terminate the instance recently and start a new one. This meant that the private IP address of the DNS server changed and I had to log in to each of my other 15 server one-by-one and change the DNS address to point to the new DNS server.

There must be a better way to do this, if so, what is it?


Use puppet to keep the configuration in sync. Changing the configuration on your puppet server it will be replicated on all other servers.

Also you can use bcfg2 or cfengine, is your choice.

Just for a simple file synchronization you can use unison.

  • Its actually a windows server so none of those are options. Plus what if the IP address of the 'puppet server' changes - same problem. – reach4thelasers Mar 19 '11 at 17:00
  • on pupet server you can use host not IP. anyway if you have windows, then my response is invalid. – Sacx Mar 19 '11 at 17:05

I have a script set up to deal with this which sets up a hosts file with aliases on one of my servers here, then scp's it to the various instances. So it uses ec2-describe-instances to list all the machines, the name tag of the instance is also the name that the machine is known as. This is for a mixture of windows and unix ec2-instances.

So ec2-describe-instance returns (shortnened):-

db domu-blah.amazonaws-1.com

I then build up a hosts file using awk, which looks like:- localhost localhost.localdomain db

This then get's sent to all the machines in the system using scp. Seems to work pretty well!


For such case of multinode installation on EC2, I've used this Exapark utility: http://www.exapark.com/product.html

It's quite easy to install and quick to run. It takes Name tag of instances and their private IPs and puts togather in hosts file. So you can configure inter-instance connections with persistent names resolved to private IPs.


If the server gets as little traffic as a DNS server would, it probably makes sense to use an elastic IP internally, if you have any to spare.

Incidentally, a useful fact is that the public DNS name of an instance resolves from within EC2 to its internal IP — even if an elastic IP is in use:

ip-10-170-25-38:~$ host ec2-50-18-56-241.us-west-1.compute.amazonaws.com
ec2-50-18-56-241.us-west-1.compute.amazonaws.com has address

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.