Hibernate an Amazon EC2 instance (original) (raw)

You can initiate hibernation on an On-Demand Instance or Spot Instance if the instance is an EBS-backed instance, is enabled for hibernation, and meets the hibernation prerequisites. If an instance cannot hibernate successfully, a normal shutdown occurs.

Console

To hibernate an instance
  1. Open the Amazon EC2 console athttps://console.aws.amazon.com/ec2/.
  2. In the navigation pane, chooseInstances.
  3. Select an instance, and choose Instance state, Hibernate instance. IfHibernate instance is disabled, the instance is already hibernated or stopped, or it can't be hibernated. For more information, see Prerequisites for EC2 instance hibernation.
  4. When prompted for confirmation, chooseHibernate. It can take a few minutes for the instance to hibernate. The instance state first changes toStopping, and then changes toStopped when the instance has hibernated.

AWS CLI

To hibernate an instance

Use the stop-instances command and specify the--hibernate parameter.

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

PowerShell

To hibernate an instance

Use the Stop-EC2Instance cmdlet.

Stop-EC2Instance `
    -InstanceId i-1234567890abcdef0 `
    -Hibernate $true

You can check whether hibernation was initiated on an instance.

Console

To view if hibernation was initiated on an instance
  1. Open the Amazon EC2 console athttps://console.aws.amazon.com/ec2/.
  2. In the navigation pane, chooseInstances.
  3. Select the instance and, on the Details tab, in the Instance details section, check the value for State transition message.
    Client.UserInitiatedHibernate: User initiated hibernate indicates that you initiated hibernation on the On-Demand Instance or Spot Instance.

AWS CLI

To view if hibernation was initiated on an instance

Use the describe-instances command and specify thestate-reason-code filter to see the instances on which hibernation was initiated.

aws ec2 describe-instances \
    --filters "Name=state-reason-code,Values=Client.UserInitiatedHibernate"

The following field in the output indicates that hibernation was initiated on the On-Demand Instance or Spot Instance.

"StateReason": {
    "Code": "Client.UserInitiatedHibernate"
}

PowerShell

To view if hibernation was initiated on an instance

Use the Get-EC2Instance cmdlet and specify thestate-reason-code filter to see the instances on which hibernation was initiated.

Get-EC2Instance `
    -Filter @{Name="state-reason-code";Value="Client.UserInitiatedHibernate"}

Disable KASLR on an instance (Ubuntu only)

Start a hibernated instance

Did this page help you? - Yes

Thanks for letting us know we're doing a good job!

If you've got a moment, please tell us what we did right so we can do more of it.

Did this page help you? - No

Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.