Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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 :

 su - USER_FOOBAR -c /PATH/TO/MY_APP &

or if as root :

 /PATH/TO/MY_APP &
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
add comment

Your Answer

 
discard

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.