#!/bin/bash # Add this script in your user-data to turn on the hibernation support # for the EC2 Spot Instances. # Make sure the agent is added to the auto-start systemctl enable hibagent # And start it exec systemctl start hibagent