Skip to content

EC2 Hibernation

Hibernation writes the contents of an instance’s RAM to its EBS root volume and stops the instance. On the next start the memory image is restored and processes resume where they left off, so the operating system does not reboot and long initialisation work is not repeated.

That makes it useful for instances that take a long time to become useful — large in-memory caches, licensed software with a slow start-up, an analyst’s workstation with a session worth keeping — and lets you stop paying for compute between uses while keeping the state.

Hibernation must be enabled at launch. It cannot be turned on for an existing instance, running or stopped, and every one of the following has to be true.

Instance family. Most current-generation general purpose, compute optimised, memory optimised and storage optimised families support hibernation, including the burstable T family and every Graviton generation. Bare metal instances do not. Rather than trust any list, ask the API for the Region you are launching in:

Terminal window
aws ec2 describe-instance-types \
--filters Name=hibernation-supported,Values=true \
--query "InstanceTypes[*].[InstanceType]" \
--output text | sort

Instance RAM. Linux instances must have less than 150 GiB of RAM. Windows instances must have 16 GiB or less — a much tighter limit that is easy to miss.

Root volume. The root device must be an EBS volume, not instance store, and it must be encrypted: the memory image written to it during hibernation contains whatever was in RAM, so AWS validates encryption before the launch succeeds. Enable EBS encryption by default in the account, launch from an encrypted AMI, or request encryption at launch. The volume must also be large enough to hold the RAM image on top of normal usage — space is reserved for it at launch.

EBS volume types. gp2, gp3, io1 or io2. Provisioned IOPS volumes need enough IOPS to write and read the memory image at a reasonable speed.

Operating system. A supported HVM AMI: AL2023, Amazon Linux 2, recent Ubuntu LTS releases, and Windows Server 2012 and later. RHEL, CentOS and Fedora are supported on Nitro instances with extra configuration.

Purchase option. On-Demand, Reserved and Spot Instances can all hibernate. For Spot, the request type must be persistent and the request must not specify a launch group.

  • An instance cannot stay hibernated for more than 60 days. After that AWS stops it in the ordinary way and the memory image is lost.
  • Hibernation is not free storage: you pay for the EBS volume holding the memory image while the instance is stopped.
  • Instance store volumes are not preserved, and neither is anything the guest was holding on them.