I have a small EC2 instance running Ubuntu 9.10. I cannot stop or terminate it because it's a production server and we cannot lose our IP.

I have an Amazon EBS volume that is our root drive and I have several snapshots of this drive. We attempted to upgrade our version of PHP today and it nuked a few things. I need to reload an old snapshot without terminating or stopping the instance. How can this be done?



Whenever you find yourself in a situation where a server cannot be rebooted, you ought to question how you have things set up. Amazon has their Elastic IP product specifically for this purpose. I'd recommend that you get that set up.

Regarding your snapshot, I'd be very hard pressed to believe you'll be able to do this. Even if it were possible to restore a snapshot to a running system, the operating system would not survive that without crashing. You're either going to need to fix the PHP issues or you'll need to swallow your pride and just deal with a bit of downtime.

To ensure your downtime is as short as possible, shorten the TTL of the DNS record for this host to 60 seconds or something like that. This will ensure that DNS resolvers won't cache the record for too long. When you're ready, take down the server, restore the snap, fire up a new instance, and re-configure your DNS to point to the elastic IP.

  • Thanks, not sure how I missed the Elastic IPs. Really wish I had saw those back in August. – mdgreenwald Nov 24 '10 at 5:04
  • Sure thing - hopefully it'll work out well for you. I certainly don't envy the situation that you're currently in, but hopefully you'll be able to pull out of it without too much hassle and/or downtime. – EEAA Nov 24 '10 at 5:07
  • Eh, it's not so bad. My excitement about being able to test new products on a test instance and then re-map the elastic IP when it's ready to go live and then ditch the old instance makes up for the headache. – mdgreenwald Nov 24 '10 at 5:27

You can't do exactly what you're asking. You'll need to start a new instance off of the snapshot, and then you can either:

  • Copy the affected files back to your old instance, or...
  • Change DNS or move the elastic IP to point to your new instance, moving the production traffic over.

I'd recommend the latter, as going through the process will make sure you're prepared to bring your service back up in case an instance fails.

It sounds like you might not be using an elastic IP, because you're worried about losing your IP. Because instances fail under normal operation, you'll want to get that fixed ASAP. You can work without elastic IPs, but you need some other layer of abstraction: DNS or elastic load balancer can both work well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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