Aside for stopping and terminating EC2 instances there is a third option which allows us to hibernate an EC2 instance.
Currently when we stop an EC2 instance any data on our EBS volume is saved until the EC2 instance is started again.
If we terminate an EC2 instance any EBS information which is at a root volume level or has been designated to be destroyed will be lost. Note, any EBS volume which is attached a secondary volume to an EC2 instance and is not setup to have it’s data destroyed on termination of the instance will not lost.
So, what exactly is EC2 Hibernate? Think of putting your EC2 instance into a sleep mode. When an EC2 instance is placed into Hibernate mode the state of the instance is written to disk e.g. The Operating System is not actually stopped which means that starting the instance is much faster.
For security reasons the instance state which has been written to the EBS volume is encrypted
The following are some important notes surrounding hibernation and EC2 instances:
- Not all EC2 instance families are supported and there is a 150 GB limit on the RAM size of the EC2 instance.
- Bare Metal EC2 instances are not supported and the root volume of the EC2 instance must be EBS, not an instance store, large enough to be able to save the state of the EC2 instance and also encrypted
- Hibernation is only available for On-Demand and Reserved EC2 instances (Not Spot Instances) and there is a sixty day maximum limit on the amount of time that an EC2 instance can be hibernated.