Overview
Lab details
- This lab walks you through hibernating an EC2 Instance.
- Duration: 30 minutes
- AWS Region: US East (N. Virginia) us-east-1
Introduction
What happens when an EC2 instance is hibernated ?- When an instance is hibernated, EC2 tells the operating system to suspend-to-disk.
- Hibernation saves the RAM contents to the EBS root volume EC2 persists the instance EBS root volume and any attached EBS data volumes
- When you start your instance after hibernation:
- EBS root volume is restored to its previous state
- RAM contents are reloaded.
- Processes that were previously running on the instance are resumed.
- Originally attached data volumes are reattached and the instance keeps its instance ID.
Architecture diagram

Task details
- Sign into AWS Management Console.
- Launch an Instance including Stop-Hibernate option.
- Testing Hibernation of an EC2 Instance.
- Validation of the Lab.
- Deleting AWS Resources.
Launching the lab environment
- To launch the lab environment, Click on the Launch lab button.
- Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
- Once the Lab is started, you will be provided with IAM user name, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time.
Lab guide
Lab steps
Task 1: Sign in to AWS Management Console
- Click on the Open console button, and you will get redirected to AWS Console in a new browser tab.
- On the AWS sign-in page,
- Leave the Account ID as default. Never edit/remove the 12 digit Account ID present in the AWS Console. otherwise, you cannot proceed with the lab.
- Now copy your User Name and Password in the Lab Console to the IAM Username and Password in AWS Console and click on the Sign in button
- Once Signed In to the AWS Management Console, Make the default AWS Region as US East (N. Virginia) us-east-1.
Task 2: Launching an EC2 Instance
- Navigate to EC2 by clicking on the Services menu in the top, then click on EC2 in the Compute section.
- Make sure you are in the US East (N. Virginia) us-east-1 Region.
- Navigate to Instances on the left panel and click on Launch instances.
- Enter the Name for the Instance
- Name : Enter WhizInstance

- Choose an Amazon Machine Image (AMI): Select Amazon Linux 2023 AMI in the drop-down.
- Choose architecture as 64-bit(x86)

- Choose an Instance Type: Select t2.micro.

- Key Pair: Select Create a new key pair
- Key pair type : Select RSA
- Key pair name: Enter MyEC2Key
- Private key file format: Select .pem
- Click on the create Key pair button.

- Click on the drop-down of the Network Settings.
- Configure Security Group:
- Select Create security group
- Select SSH type
-
Source Type: Select My IP.

- Click on the Advanced option at the top right corner of the Configure Storage.

- Click on Volume 1 (AMI Root).

- Select Encrypted option from the Encrypted drop-down and (default) aws/ebs key from the KMS Key drop-down.

- Click on the Advanced details button and select Enable from the Stop-Hibernate Behaviour drop-down.

- Review and Launch: Review all settings and click on Launch Instance at the bottom right.
- Launch Status: Your instance is now launching, Click on the instance ID and wait for complete initialization of the instance till the status changes to Running.
Task 3: Testing Hibernation of an EC2 Instance
We can test the hibernation of the EC2 either using the Dashboard or using CloudShell. Wait till the Status Check of instance become passed.Method 1:
- Select the instance from the Instances panel and click on Instance State.
- Click on Hibernate Instance.

-
Select the Hibernate button.

- You can see that the Instance state has been changed from Running to Stopped.

- Select the Instance again and Select Instance State as Start Instance.

- We can see that Instance starts running again.
Method 2:
- Go to EC2 Dashboard and copy the Instance ID of your instance.
- Go to AWS CloudShell by clicking on

- We can use the Stop action to hibernate an instance because we have enabled the Stop-Hibernation behavior. To hibernate the instance, run the command:
Replace <instance_id> with the Instance ID you have copied in Step 1. Wait for 2 to 3 minutes for the instance to get stopped.

- Run the following command to start the instance.
Replace
<instance_id> with the Instance ID you copied in step 1.- Wait for a few minutes and run the command again. You can see that the instance state has changed from pending to running state.

Task 4: Validation of the Lab
- Once the lab steps are completed, please click on the Check my work button on the right side panel.
- This will validate the resources in the AWS account and displays whether you have completed this lab successfully or not.
- Sample output :

Task 5: Deletion of AWS Resources
1. Terminate EC2 Instance :-- In the navigation pane, choose Instances.
- Select the instance, and choose Instance state and click on Terminate instance.
- Choose Terminate when prompted for confirmation.
Completion and conclusion
- You have successfully launched an EC2 Instance.
- You have successfully hibernated an EC2 Instance.
End lab
- Sign out of the AWS Account.
- You have successfully completed the lab.
- Click on End lab button in the IP Lab Portal and wait till the process gets completed.
What gets checked
When you press Check my work, the platform verifies each of these:- Login to AWS Management Console — Check whether the user has logged in to the AWS Management Console.
- Hibernate an EC2 Instance — Check if an amazon linux EC2 instance launched with Stop-Hibernate Behaviour enabled or not.