7

I've got an application I'd like to move to EC2. It will likely spend more than half the day completely dormant, so I'm trying to come up with a good solution for starting and stopping it as needed. It takes a few minutes to start up from nothing, so it would be nice if i could hibernate the OS for quicker resumes. I've seen a couple forum discussions on the topic of hibernation within EC2, but never anything conclusive. Has anyone found a working solution to this, or at least some resources that could help me out?

Jeff Ferland
  • 20,987
Dan
  • 351

4 Answers4

11

This has been discussed on the EC2 forums.

Highlights, direct from Amazon's mouth:

  1. if you do manage to hibernate the OS your Instance will still be in a running state i.e. you will be paying for the instance.

  2. how do you plan to wake up this instance from it's sleeping state.

This really does not sound like it will work, We would recommend that you configure your instance to automatically launch all the services you need at boot time and use the stop/start feature of EBS backed instances as a solution to your problem.

(or, in plain English -- Don't bother. It won't save you any money, and it probably won't work anyway)

voretaq7
  • 80,749
3

I just hibernated an EBS based Windows AMI and then restarted it and it resumed fine. I would guess Linux works the same (as long as it stores the hibernate data to an EBS volume and then powers off the virtual machine).

(hibernation was disabled in the AMI, I turned it on using

powercfg /H on

and then performing the hibernation with

shutdown /h

)

PS: Take note of this: when an instance is stopped and later started again, all the instance stores are reset! Operating systems don't like disk content changing between hibernate and resume. (after resuming the OS may still show some remains of the previous disk content that is cached in the OS file cache)

3

Stumbled upon this question, EC2 Hibernation is now supported for Ubuntu 18.04.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites

2

Old question, but it seems this feature has been implemented, at least for Amazon Linux 1, with an encrypted root volume. Hopefully Ubuntu support is on its way.

https://aws.amazon.com/blogs/aws/new-hibernate-your-ec2-instances/