How does hibernation impact snapshots within EC2?
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
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.
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.
Relevant questions
Hibernation not working as expected
asked 3 months agoWindows 2008 EC2
Accepted Answerasked 2 years agoHow does hibernation impact snapshots within EC2?
Accepted Answerasked 3 months agoClarifying MSK data transfer pricing within region or AZ
Accepted Answerasked 3 years agoDoes AWS Batch support EC2 Spot stop/start and hibernation
Accepted Answerasked 4 years agoCan't launch ec2 spot instance with hibernation for instance type c5.18xlar
asked a year agohow can I configure cloudwatch to monitor things like CPU/RAM/Disk/IO for auto scaling groups using a wildcard?
asked 5 months agoHow does data transfer pricing work between lambda function urls and cloudfront?
asked a month agoConcurrentSnapshotLimitExceeded when no in-progress snapshots listed in EC2 Snapshots manager
asked 2 months agoHow long does it take for the payment for a RI to take effect?
asked 2 years 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.