How Amazon EC2 instance hibernation works
The following diagram shows a basic overview of the hibernation process for EC2 instances.
What happens when you hibernate an instance
When you hibernate an instance, the following happens:
-
The instance moves to the
stopping
state. Amazon EC2 signals the operating system to perform hibernation (suspend-to-disk). The hibernation freezes all of the processes, saves the contents of the RAM to the EBS root volume, and then performs a regular shutdown. -
After the shutdown is complete, the instance moves to the
stopped
state. -
Any EBS volumes remain attached to the instance, and their data persists, including the saved contents of the RAM.
-
Any Amazon EC2 instance store volumes remain attached to the instance, but the data on the instance store volumes is lost.
-
While your instance is in the
stopped
state, you can modify certain attributes of the instance, including the instance type or size. -
In most cases, the instance is migrated to a new underlying host computer when it's started. This is also what happens when you stop and start an instance.
-
When the instance is started, the instance boots up and the operating system reads in the contents of the RAM from the EBS root volume, before unfreezing processes to resume its state.
-
The instance retains its private IPv4 addresses and any IPv6 addresses. When the instance is started, the instance continues to retain its private IPv4 addresses and any IPv6 addresses.
-
Amazon EC2 releases the public IPv4 address. When the instance is started, Amazon EC2 assigns a new public IPv4 address to the instance.
-
The instance retains its associated Elastic IP addresses. You're charged for any Elastic IP addresses that are associated with a hibernated instance.
For information about how hibernation differs from reboot, stop, and terminate, see Differences between instance states.
Limitations
-
When you hibernate an instance, the data on any instance store volumes is lost.
-
(Linux instances) You can't hibernate a Linux instance that has more than 150 GB of RAM.
-
(Windows instances) You can't hibernate a Windows instance that has more than 16 GB of RAM.
-
If you create a snapshot or AMI from an instance that is hibernated or has hibernation enabled, you might not be able to connect to a new instance that is launched from the AMI or from an AMI that was created from the snapshot.
-
(Spot Instances only) If Amazon EC2 hibernates your Spot Instance, only Amazon EC2 can resume your instance. If you hibernate your Spot Instance (user-initiated hibernation), you can resume your instance. A hibernated Spot Instance can only be resumed if capacity is available and the Spot price is less than or equal to your specified maximum price.
-
You can't hibernate an instance that is in an Auto Scaling group or used by Amazon ECS. If your instance is in an Auto Scaling group and you try to hibernate it, the Amazon EC2 Auto Scaling service marks the stopped instance as unhealthy, and might terminate it and launch a replacement instance. For more information, see Health checks for instances in an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
-
You can't hibernate an instance that is configured to boot in UEFI mode with UEFI Secure Boot enabled.
-
If you hibernate an instance that was launched into a Capacity Reservation, the Capacity Reservation does not ensure that the hibernated instance can resume after you try to start it.
-
You can’t hibernate an instance that uses a kernel below 5.10 if Federal Information Processing Standard (FIPS) mode is enabled.
-
We do not support keeping an instance hibernated for more than 60 days. To keep the instance for longer than 60 days, you must start the hibernated instance, stop the instance, and start it.
-
We constantly update our platform with upgrades and security patches, which can conflict with existing hibernated instances. We notify you about critical updates that require a start for hibernated instances so that we can perform a shutdown or a reboot to apply the necessary upgrades and security patches.
Considerations for hibernating a Spot Instance
-
If you hibernate your Spot Instance, you can restart it provided capacity is available and the Spot price is less than or equal to your specified maximum price.
-
If Amazon EC2 hibernates your Spot Instance:
-
Only Amazon EC2 can resume your instance.
-
Amazon EC2 resumes the hibernated Spot Instance when capacity becomes available with a Spot price that is less than or equal to your specified maximum price.
-
Before Amazon EC2 hibernates your Spot Instance, you'll receive an interruption notice two minutes before hibernation starts.
For more information, see Spot Instance interruptions.
-