Hibernating Ubuntu on EC2 instance?

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)


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)


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