In 2018, Amazon Web services launched the Hibernation feature that allows you to pause your EC2 instances and resume to the saved state without any loss.
In collaboration with AWS, Canonical, the parent company behind the Ubuntu Linux distro, announced the hibernation support for Ubuntu 16.04 LTS. However, Ubuntu 18.04 LTS already supports hibernation, a feature which was added last year.
To avoid memory loss, the hibernation process stores the in-memory state of the instance, along with its private and elastic IP addresses, allowing it to resume with the saved state.
Sadly, Ubuntu 16.04 LTS is not available for new users on AWS owing to the end of support for v16.04 on April 2021. However, extended security maintenance will be provided for premium customers for a further three years.
How To Enable The Hibernate Support In AWS EC2?
If you want to include the hibernation support in your existing Ubuntu 16.04 instance, you need to install the latest linux-aws-hwe kernel package v4.15.0-1058-aws along with ec2-hibinit-agent.
Find your dream job
You can run the command given below:
sudo apt update sudo apt install linux-aws-hwe sudo apt install ec2-hibinit-agent sudo reboot
Canonical will provide regular updates for packages until April 2021 with extended security maintenance for paid users till 2024.
You also need to disable the KASLR (Kernel Address Space Layout Randomisation) kernel security feature to avoid the AWS hibernation failure. If your KASLR is enabled, then you may not be able to resume your status.
To disable KASLR for an instance, you can follow the steps given here.