What is EC2 Hibernate?

EC2 Hibernate
EC2 Hibernate

EC2 Hibernate: Explanation with Examples

πŸ“Œ What is EC2 Hibernate?

EC2 Hibernate is a feature that preserves the in-memory state of an instance when it is stopped, allowing you to resume from where you left off without losing data. It works like hibernation in a laptop, where active applications and processes remain intact when the machine is powered back on.


πŸ“Œ How EC2 Hibernate Works?

1️⃣ When an instance is put into hibernation, its RAM contents are saved to the root volume.
2️⃣ The instance is stopped, and EBS volumes remain attached.
3️⃣ When you start the instance again, it restores the saved RAM state, so applications resume running from the exact same point before hibernation.


πŸ“Œ Example Scenario: Using EC2 Hibernate

Scenario 1: Running a Long Process

Imagine you are running a data processing job on EC2 that takes multiple hours to complete. Instead of stopping and restarting the instance (which would require restarting the job), you can:

βœ… Hibernate the EC2 instance when needed.
βœ… Resume it later without losing progress.

Scenario 2: Application Servers with Preloaded Data

βœ… A financial trading application with preloaded datasets can be hibernated overnight and resumed instantly in the morning without reloading data.

Scenario 3: Development Environments

βœ… Developers can hibernate EC2 instances running development tools and resume their work the next day without rebooting everything.


πŸ“Œ Key Features of EC2 Hibernate

βœ” Saves RAM state and resumes applications instantly.
βœ” Faster startup compared to rebooting.
βœ” No additional cost apart from standard EBS storage.
βœ” Supported on Amazon Linux, Ubuntu, Windows, RHEL (with specific instance types).


πŸ“Œ Limitations of EC2 Hibernate

🚫 Only supports instances with up to 150 GB RAM.
🚫 Requires encrypted EBS root volume.
🚫 Only EBS-backed instances are supported.
🚫 Not available on bare metal or burstable instances (T2, T3, etc.).


πŸ“Œ How to Enable EC2 Hibernate?

Step 1: Check Instance Compatibility

  • Instance type should support hibernation (e.g., C5, M5, R5, T3).
  • Root volume should be EBS-backed and encrypted.

Step 2: Enable Hibernate Option

  • While launching the EC2 instance, go to Advanced Details.
  • Select Enable Hibernation under Shutdown Behavior.

Step 3: Hibernate the Instance

Use the following AWS CLI command:

aws ec2 stop-instances --instance-ids i-1234567890abcdef0 --hibernate

Step 4: Start the Instance Again

aws ec2 start-instances --instance-ids i-1234567890abcdef0

πŸ“Œ Difference Between Stop, Terminate, and Hibernate

ActionWhat Happens?RAM State Preserved?EBS Volume Attached?Use Case
StopInstance shuts down❌ Noβœ… YesSave storage, restart later
TerminateInstance is deleted❌ No❌ NoNo longer needed
HibernateInstance saves RAM & stopsβœ… Yesβœ… YesResume workloads instantly

πŸš€ Why Use EC2 Hibernate?

βœ… Faster startup – Resume workloads instantly.
βœ… Cost savings – Pay only for storage, not compute.
βœ… Data retention – No need to reload applications after every reboot.

πŸ’‘ Need help enabling EC2 Hibernate for your workloads? Contact us today! πŸš€

About Anant 401 Articles
Senior technical writer