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

I had amazon ec2 account. I had an instance which associated with a elastic ip . But when I stop and start the instance then the Elastic ip detached from the instance . I have to associate the elastic ip manually each time after starting the instance. Is there any script for auto attach the elastic ip on starting the instance .? Please let me know.

share|improve this question
Have you done any research yourself ? – Drew Khoury Oct 8 '13 at 9:18

You can run the below command on your instance start up.

  ec2-associate-address -i <instance ID> <elastic IP Address> --region <region name>

A simple approach is to add a line in /etc/rc.local :


or if as root :

share|improve this answer
Thank you for the reply .where I need to add this script. – user2724174 Oct 8 '13 at 9:08
I have edited my answer. – Abhishek Anand Amralkar Oct 11 '13 at 10:35

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.