Tuesday, April 29, 2025

EC2 Hibernate : Pause Instances & Resume it later.

 

EC2 Hibernate is a feature in AWS EC2 that lets twtech to pause its instances and resume it later — just like putting a laptop to sleep instead of shutting it down.

twtech quick idea:

  • When twtech hibernates an EC2 instance, AWS saves the contents of the RAM (memory) to twtech instance’s root EBS volume.
  • When twtech start the instance again, it loads the RAM contents back — so all twtech processes, in-memory data, and open sessions are exactly as they were.
  • It's faster than a full reboot and twtech doesn't lose any in-progress data.

Key things about Hibernate:

  • It only works on instances with EBS root volumes (not instance store).
  • RAM limit: up to 150 GB.
  • twtech need to enable hibernation at instance launch…so twtech can’t just turn it on later.
  • NB: twtech is charged for the EBS storage and any other attached resources while the instance is hibernated, but not for compute time (since the instance isn’t running).

Common use cases:

  • Spot instances where you want fast recovery.
  • Long-running applications that you want to pause and resume.
  • Development environments you don't want to restart from scratch every time.

twtech-Insights:

•  It Supports Instance Families like: C3, C4, C5, I3, M3, M4, R3, R4, T2, T3...

•  The Instance RAM Size should be less than 150 GB.

 •  The Instance Size is not supported for bare metal instances.

•  It works for these AMI:  Amazon Linux 2, Linux AMI, Ubuntu, RHEL, CentOS & Window.

•   The Root Volume should be EBS, encrypted, not instance store, and large.

•  It is available for On-Demand, Reserved and Spot Instances.

•  Worth noting, instances can NOT be hibernated more than 60 days. 

Project:

(Hands-on)

How twtech launches instances with Hibernating feature enabled:

step-by-step:



twtech Selected OS for this project: Redhat


Configure the advance feature of the EBS volume:

Configure to encrypt the EBS volume with aws key

Go to instance advance detailts and navigate to: Stop-Hibernate behavior.



Next:

Connect to instance (ssh) and run the uptime command to see how long the instance has been runnig: uptime

The uptime command in Linux (and Unix-like systems) shows how long the system has been running, along with other basic information like the number of users and the system load averages.

When you type:

#  bash

uptime

output:

#  bash

15:24:36 up 12 days,  3:22,  3 users,  load average: 0.12, 0.08, 0.05

Here's what each part means:

  • 15:24:36 → Current system time.
  • up 12 days, 3:22 → The system has been running for 12 days and 3 hours 22 minutes.
  • 3 users → There are 3 users currently logged in.
  • load average: 0.12, 0.08, 0.05 → The system load averages for the last 1, 5, and 15 minutes.

How twtech hibernates the instance eventually.

Select the instance, then go to instance state, and Hibernate instance

Confirm hibernation:


Insights:

The stopped instance has data stored on the ebs volume.


twtech may restart the instance at any time and its data will synchronize from the ebs volume to the Ram.


Wait until instance status is fully initialized : it may take a couple of minutes for data to synchronize from EBS to the RAM.

from

To:

twtech successufly hibernate its webs server for 5 minutes before restarting it again.


No comments:

Post a Comment

Kubernetes Clusters | Upstream Vs Downstream.

  The terms "upstream" and "downstream" in the context of Kubernetes clusters often refer to the direction of code fl...