By using AWS re:Post, you agree to the Terms of Use
/How does hibernation impact snapshots within EC2?/

How does hibernation impact snapshots within EC2?

0

Under the limitations page for hibernation within EC2 [1], it is mentioned that: "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 the instance.". Could anyone clarify the meaning of this statement.

Does it mean:

  • You might not be able to connect to the instance whilst the snapshot or AMI creation is in progress
  • You might not be able to connect to the instance after restoring the snapshot or launching a new instance from the AMI
  • Something else
  1. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-hibernate-limitations.html
1 Answers
1
Accepted Answer

An instance that is hibernated is literally "stopped in its tracks" - there will be open files, structures in memory, processes that are running and potentially disk volumes that aren't in a healthy state - because the operating system didn't know it was supposed to flush things to disk.

So if you take a snapshot of it while hibernated and then try to launch an AMI from that, it's going to launch from exactly the state it was in; which isn't necessarily where the operating system expects to start from. So it might work. But it might not.

EXPERT
answered 3 months ago
  • Thank you, that makes sense to me. Is there a supported method for running automated snapshots on instances that may or may not be hibernated?

    I am concerned about the possibility of not being able to trust backups for instances that are likely to be hibernated when backups are taken. Obviously this possibility, if it exists, is untenable in most cases.

  • A snapshot of a running or hibernated instance carries the same risk - the filesystem(s) may not be in a stable (shutdown) state. This is particularly true for applications such as databases which at any point in time are not necessarily completely flushed to disk. With a running instance you might send it a single (or use Systems Manager) to temporarily halt writes to the disk, flush buffers then snapshot; but that's not possible with a hibernated instance.

  • Are you saying that the risks posed when snapshotting a hibernated instance are no greater than the risks posed when snapshotting a running instance? If I were to run a snapshot on a hibernated instance and find that I could not connect to the instance after restoring from the snapshot, my assumption would be that a hard reboot would resolve the issue. I would lose the processes that were in memory when the snapshot occurs but the instance itself would be recoverable. Am I missing anything that would void this assumption. Thank you for taking the time to answer my queries.

  • In both cases, a reboot might fix the issue. In general, modern file systems are pretty resilient and a reboot is highly likely to fix any issues. The same can't be said for all application data structures. Again, many (if not most!) applications are good at recovering from being interrupted (a power failure would give the same experience) but there are no guarantees.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions