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.

Every time I reboot my Ubuntu based EC2 instances, they do not automatically get the IP so I have to associate them manually from the admin panel. Each instance should have a single IP assigned.

Is there any way to make this auto?

share|improve this question
1  
Yes, you could write a script that uses the AWS EC2 command-line tools to re-associate on reboot. –  ceejayoz Nov 20 '12 at 20:12

1 Answer 1

When you reboot an EC2 instance, nothing changes with the IP addresses, so your question as currently phrased is invalid.

Perhaps you are talking about stopping and starting an EBS boot instance which had an Elastic IP address associated with it?

If you have a non-VPC EC2 instance with an Elastic IP address associated with it, and you stop that instance, then yes, the Elastic IP address will no longer be associated to it when it is restarted.

You have a few directions you can go depending on your particular situation:

  1. Create a boot script on the instance that checks to see if the Elastic IP address is associated and associates it if needed. WARNING: If you create an AMI of this instance and start new instances, they may grab the Elastic IP address from each other depending on how you write this.

  2. Change your process that starts the EC2 instance so that it starts the instance and associates the Elastic IP address.

  3. Run your EC2 instance in VPC. An EBS boot VPC instance will keep its Elastic IP address through a stop/start cycle.

Here's an article I wrote on more differences between reboot and stop/start of EBS boot instances:

http://alestic.com/2011/09/ec2-reboot-stop-start

share|improve this answer

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.