

# Amazon EC2 Dedicated Host recovery
<a name="dedicated-hosts-recovery"></a>

Dedicated Host auto recovery restarts your instances on to a new replacement host when certain problematic conditions are detected on your Dedicated Host. Host recovery reduces the need for manual intervention and lowers the operational burden if there is an unexpected Dedicated Host failure concerning system power or network connectivity events. Other Dedicated Host issues will require manual intervention to recover from. 

**Topics**
+ [How host recovery works](dedicated-hosts-recovery-basics.md)
+ [Supported instance types](#dedicated-hosts-recovery-instances)
+ [Pricing](#dedicated-hosts-recovery-pricing)
+ [Manage host recovery](dedicated-hosts-recovery-enable.md)
+ [View host recovery setting](dedicated-hosts-recovery-view.md)
+ [Manually recovery unsupported instances](dedicated-hosts-recovery-unsupported.md)

# How Amazon EC2 Dedicated Host recovery works
<a name="dedicated-hosts-recovery-basics"></a>

Dedicated Hosts and the host resource groups recovery process use host-level health checks to assess Dedicated Host availability and to detect underlying system failures. The type of Dedicated Host failure determines if Dedicated Host auto recovery is possible. Examples of problems that can cause host-level health checks to fail include:
+ Loss of network connectivity
+ Loss of system power
+ Hardware or software issues on the physical host

**Important**  
Dedicated Host auto recovery does not occur when the host is scheduled for retirement.

## Dedicated Host auto recovery
<a name="dedicated-hosts-recovery-basics-auto-recovery"></a>

When a system power or network connectivity failure is detected on your Dedicated Host, Dedicated Host auto recovery is initiated and Amazon EC2 **automatically allocates a replacement Dedicated Host in the same Availability Zone as the original Dedicated Host**. The replacement Dedicated Host receives a new host ID, but retains the same attributes as the original Dedicated Host, including:
+ Availability Zone
+ Instance type
+ Tags
+ Auto placement settings
+ Reservation

When the replacement Dedicated Host is allocated, the **instances are recovered on to the replacement Dedicated Host**. The recovered instances retain the same attributes as the original instances, including:
+ Instance ID
+ Private IP addresses
+ Elastic IP addresses
+ EBS volume attachments
+ All instance metadata

Additionally, the built-in integration with AWS License Manager automates the tracking and management of your licenses.

**Note**  
AWS License Manager integration is supported only in Regions in which AWS License Manager is available. 

If instances have a host affinity relationship with the impaired Dedicated Host, the recovered instances establish host affinity with the replacement Dedicated Host.

When all of the instances have been recovered on to the replacement Dedicated Host, **the impaired Dedicated Host is released**, and the replacement Dedicated Host becomes available for use.

When host recovery is initiated, the AWS account owner is notified by email and by an AWS Health Dashboard event. A second notification is sent after the host recovery has been successfully completed. 

If you are using AWS License Manager to track your licenses, AWS License Manager allocates new licenses for the replacement Dedicated Host based on the license configuration limits. If the license configuration has hard limits that will be breached as a result of the host recovery, the recovery process is not allowed and you are notified of the host recovery failure through an Amazon SNS notification (if notification settings have been configured for AWS License Manager). If the license configuration has soft limits that will be breached as a result of the host recovery, the recovery is allowed to continue and you are notified of the limit breach through an Amazon SNS notification. For more information, see [Using License Configurations](https://docs.aws.amazon.com/license-manager/latest/userguide/license-configurations.html) and [Settings in License Manager](https://docs.aws.amazon.com/license-manager/latest/userguide/settings.html) in the *AWS License Manager User Guide*.

## Host recovery states
<a name="dedicated-hosts-recovery-states"></a>

When a Dedicated Host failure is detected, the impaired Dedicated Host enters the `under-assessment` state, and all of the instances enter the `impaired` state. You can't launch instances on to the impaired Dedicated Host while it is in the `under-assessment` state.

After the replacement Dedicated Host is allocated, it enters the `pending` state. It remains in this state until the host recovery process is complete. You can't launch instances on to the replacement Dedicated Host while it is in the `pending` state. Recovered instances on the replacement Dedicated Host remain in the `impaired` state during the recovery process.

After the host recovery is complete, the replacement Dedicated Host enters the `available` state, and the recovered instances return to the `running` state. You can launch instances on to the replacement Dedicated Host after it enters the `available` state. The original impaired Dedicated Host is permanently released and it enters the `released-permanent-failure` state.

If the impaired Dedicated Host has instances that do not support host recovery, such as instances with instance store root volumes, the Dedicated Host is not released. Instead, it is marked for retirement and enters the `permanent-failure` state.

## Scenarios without Dedicated Host auto recovery
<a name="dedicated-hosts-recovery-basics-non-auto"></a>

**Dedicated Host auto recovery does not occur when the host is scheduled for retirement**. You will receive a retirement notification in the AWS Health Dashboard, an Amazon CloudWatch event, and the AWS account owner email address receives a message regarding the Dedicated Host failure. Follow the remedial steps described in the retirement notification within the specified time period to manually recover the instances on the retiring host.

**Stopped instances are not recovered** on to the replacement Dedicated Host. If you attempt to start a stopped instance that targets the impaired Dedicated Host, the instance start fails. We recommend that you modify the stopped instance to either target a different Dedicated Host, or to launch on any available Dedicated Host with matching configurations and auto-placement enabled.

**Instances with instance storage are not recovered** on to the replacement Dedicated Host. As a remedial measure, the impaired Dedicated Host is marked for retirement and you receive a retirement notification after the host recovery is complete. Follow the remedial steps described in the retirement notification within the specified time period to manually recover the remaining instances on the impaired Dedicated Host.

## Supported instance types
<a name="dedicated-hosts-recovery-instances"></a>

Host recovery is supported for the following instance families:
+ **General purpose: **A1 \$1 M3 \$1 M4 \$1 M5 \$1 M5n \$1 M5zn \$1 M6a \$1 M6g \$1 M6i \$1 T3 \$1 Mac1 \$1 Mac2 \$1 Mac2-m1ultra \$1 Mac2-m2 \$1 Mac2-m2pro
+ **Compute optimized: **C3 \$1 C4 \$1 C5 \$1 C5n \$1 C6a \$1 C6g \$1 C6i
+ **Memory optimized: **R3 \$1 R4 \$1 R5 \$1 R5b \$1 R5n \$1 R6g \$1 R6i \$1 U-6tb1 \$1 U-9tb1 \$1 U-12tb1 \$1 U-18tb1 \$1 U-24tb1 \$1 X1 \$1 X1e \$1 X2iezn
+ **Accelerated computing: **Inf1 \$1 G3 \$1 G5g \$1 P2 \$1 P3

To recover instances that are not supported, see [Manually recover instances that are not supported by Amazon EC2 Dedicated Host recovery](dedicated-hosts-recovery-unsupported.md).

**Note**  
Dedicated Host auto recovery of supported metal instance types will take longer to detect and recover from than non-metal instance types.

## Pricing
<a name="dedicated-hosts-recovery-pricing"></a>

There are no additional charges for using host recovery, but the usual Dedicated Host charges apply. For more information, see [ Amazon EC2 Dedicated Hosts Pricing](https://aws.amazon.com/ec2/dedicated-hosts/pricing/).

As soon as host recovery is initiated, you are no longer billed for the impaired Dedicated Host. Billing for the replacement Dedicated Host begins only after it enters the `available` state.

If the impaired Dedicated Host was billed using the On-Demand rate, the replacement Dedicated Host is also billed using the On-Demand rate. If the impaired Dedicated Host had an active Dedicated Host Reservation, it is transferred to the replacement Dedicated Host.

# Manage Amazon EC2 Dedicated Host recovery
<a name="dedicated-hosts-recovery-enable"></a>

Dedicated Host auto recovery restarts your instances on to a new replacement host when certain problematic conditions are detected on your Dedicated Host. You can enable host recovery when you allocate the Dedicated Host or after allocation.

Use the following procedures to enable host recovery when allocating the host.

------
#### [ Console ]

**To enable host recovery at allocation**  
When allocating a Dedicated Host using the Amazon EC2 console, for **Host recovery**, choose **Enable**. For more information, see [Allocate an Amazon EC2 Dedicated Host for use in your account](dedicated-hosts-allocating.md).

------
#### [ AWS CLI ]

**To enable host recovery at allocation**  
Use the [allocate-hosts](https://docs.aws.amazon.com/cli/latest/reference/ec2/allocate-hosts.html) command.

```
aws ec2 allocate-hosts \
    --instance-type m5.large \
    --availability-zone eu-west-1a \
    --auto-placement on \
    --host-recovery on \
    --quantity 1
```

------
#### [ PowerShell ]

**To enable host recovery at allocation**  
Use the [New-EC2Host](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Host.html) cmdlet.

```
New-EC2Host `
    -InstanceType m5.large `
    -AvailabilityZone eu-west-1a `
    -AutoPlacement on `
    -HostRecovery on `
    -Quantity 1
```

------

Use the following procedures to manage host recovery for a Dedicated Host.

------
#### [ Console ]

**To manage host recovery after allocation**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Dedicated Hosts**.

1. Select the Dedicated Host.

1. Choose **Actions**, **Modify host**.

1. For **Host recovery**, select or clear **Enable**.

1. Choose **Save**.

------
#### [ AWS CLI ]

**To enable host recovery after allocation**  
Use the [modify-hosts](https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-hosts.html) command.

```
aws ec2 modify-hosts \
    --host-recovery on \
    --host-ids h-012a3456b7890cdef
```

**To disable host recovery after allocation**  
Use the [modify-hosts](https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-hosts.html) command and specify the `host-recovery` parameter with a value of `off`.

```
aws ec2 modify-hosts \
    --host-recovery off \
    --host-ids h-012a3456b7890cdef
```

------
#### [ PowerShell ]

**To enable host recovery after allocation**  
Use the [Edit-host](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2Host.html) cmdlet.

```
Edit-EC2Host `
    -HostRecovery on `
    -HostId h-012a3456b7890cdef
```

**To disable host recovery after allocation**  
Use the [Edit-EC2Host](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2Host.html) cmdlet.

```
Edit-EC2Host `
    -HostRecovery off `
    -HostId h-012a3456b7890cdef
```

------

# View the host recovery setting for your Amazon EC2 Dedicated Host
<a name="dedicated-hosts-recovery-view"></a>

You can view the host recovery configuration for a Dedicated Host at any time.

------
#### [ Console ]

**To view the host recovery configuration for a Dedicated Host**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Dedicated Hosts**.

1. Select the Dedicated Host, and in the **Description** tab, review the **Host Recovery** field.

------
#### [ AWS CLI ]

**To view the host recovery configuration for a Dedicated Host**  
Use the [describe-hosts](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-hosts.html) command.

```
aws ec2 describe-hosts \
    --host-ids h-012a3456b7890cdef \
    --query Hosts[].HostRecovery
```

The following is example output.

```
on
```

------
#### [ PowerShell ]

**To view the host recovery configuration for a Dedicated Host**  
Use the [Get-EC2Host](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Host.html) cmdlet.

```
(Get-EC2Host -HostId h-012a3456b7890cdef).Hosts | Select HostRecovery
```

The following is example output.

```
HostRecovery
------------
on
```

------

# Manually recover instances that are not supported by Amazon EC2 Dedicated Host recovery
<a name="dedicated-hosts-recovery-unsupported"></a>

Host recovery does not support recovering instances that use instance store volumes. Follow the instructions below to manually recover any of your instances that could not be automatically recovered.

**Warning**  
Data on instance store volumes is lost when an instance is stopped, hibernated, or terminated. This includes instance store volumes that are attached to an instance that has an EBS root volume. To protect data from instance store volumes, back it up to persistent storage before the instance is stopped or terminated.

## Manually recover EBS-backed instances
<a name="dedicated-hosts-recovery-ebs"></a>

For EBS-backed instances that could not be automatically recovered, we recommend that you manually stop and start the instances to recover them onto a new Dedicated Host. For more information about stopping your instance, and about the changes that occur in your instance configuration when it's stopped, see [Stop and start Amazon EC2 instances](Stop_Start.md).

## Manually recover instances with instance store root volumes
<a name="dedicated-hosts-recovery-instancestore"></a>

For instances with instance store root volumes that could not be automatically recovered, we recommend that you do the following:

1. Launch a replacement instance on a new Dedicated Host from your most recent AMI.

1. Migrate all of the necessary data to the replacement instance.

1. Terminate the original instance on the impaired Dedicated Host.