Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Lets say I have an application server and a database server on Amazon EC2. If the db server fails and restarts, how can the app server know the new internal ip of the db server and automatically continue working with it?

share|improve this question
up vote 0 down vote accepted

A reboot will keep it's settings. If you bring up a new instance then you'll need some way to manage the IP's. A startup script is probably the way to go. Pull the instance metadata and update a config file (perhaps in S3) or DNS entry. You can also use an elastic IP and configure a cname which will resolve to the internal address within the EC2 environment. To do this, assign an elastic IP and note the public DNS string (there's a pattern but it's good to check) and create the cname record with it. The advantage with elastic IP cnames is you don't have to wait for DNS propagation.

share|improve this answer
Any idea where I can find example of such startup script? – Niro Jan 6 '10 at 15:47

You could have the DB server tell the application server where it is by writing a simple externally facing update URL on your application server. You can get the internal IP from the boot metadata from the DB server. Maybe a simple shell script like this in rc.local on the DB server (assuming you are using a linux instance):

curl http://<>/updatedbip?ip=$LOCALIP&somesharedsecret=<password>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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