Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

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

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:

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.