

# Amazon EC2 Dedicated Hosts
Dedicated Hosts

An Amazon EC2 Dedicated Host is a physical server that is fully dedicated for your use.

Dedicated Hosts provide visibility and control over instance placement and they support host affinity. This means that you can launch and run instances on specific hosts, and you can ensure that instances run only on specific hosts. For more information, see [Amazon EC2 Dedicated Host auto-placement and host affinity](dedicated-hosts-understanding.md).

Dedicated Hosts provide comprehensive Bring Your Own License (BYOL) support. They allow you to use your existing per-socket, per-core, or per-VM software licenses, including Windows Server, SQL Server, SUSE Linux Enterprise Server, Red Hat Enterprise Linux, or other software licenses that are bound to VMs, sockets, or physical cores, subject to your license terms.

If you require your instances to run on dedicated hardware, but you do not need visibility or control over instance placement, and you do not need to use per-socket or per-core software licenses, you can consider using Dedicated Instances instead. Dedicated Instances and Dedicated Hosts can both be used to launch Amazon EC2 instances onto dedicated physical servers. There are no performance, security, or physical differences between Dedicated Instances and instances on Dedicated Hosts. However, there are some key differences between them. The following table highlights some of the key differences between Dedicated Instances and Dedicated Hosts:


|  | Dedicated Host | Dedicated Instance | 
| --- | --- | --- | 
| Dedicated physical server | Physical server with instance capacity fully dedicated to your use. | Physical server that's dedicated to a single customer account. | 
| Instance capacity sharing | Can share instance capacity with other accounts. | Not supported | 
| Billing | Per-host billing | Per-instance billing | 
| Visibility of sockets, cores, and host ID | Provides visibility of the number of sockets and physical cores | No visibility | 
| Host and instance affinity | Allows you to consistently deploy your instances to the same physical server over time | Not supported | 
| Targeted instance placement | Provides additional visibility and control over how instances are placed on a physical server | Not supported | 
| Automatic instance recovery | Supported. For more information, see [Amazon EC2 Dedicated Host recovery](dedicated-hosts-recovery.md). | Supported | 
| Bring Your Own License (BYOL) | Supported | Partial support \$1 | 
| Capacity Reservations | Not supported | Supported | 

\$1 Microsoft SQL Server with License Mobility through Software Assurance, and Windows Virtual Desktop Access (VDA) licenses can be used with Dedicated Instance.

For more information about Dedicated Instances, see [Amazon EC2 Dedicated Instances](dedicated-instance.md).

## Dedicated Hosts restrictions


Before you allocate Dedicated Hosts, take note of the following limitations and restrictions:
+ To run RHEL and SUSE Linux on Dedicated Hosts, you must bring your own AMIs. You can't use the RHEL and SUSE Linux AMIs that are offered by Amazon or that are available on Amazon Web Services Marketplace with Dedicated Hosts. For more information about how to create your own AMI, see [Bring your own software licenses to Amazon EC2 Dedicated Hosts](dedicated-hosts-BYOL.md).

  This restriction does not apply to hosts allocated for high memory instances (`u-6tb1.metal`, `u-9tb1.metal`, `u-12tb1.metal`, `u-18tb1.metal`, and `u-24tb1.metal`). RHEL and SUSE Linux AMIs that are offered by Amazon or that are available on Amazon Web Services Marketplace can be used with these hosts.
+ There is a limit on the number of running Dedicated Hosts per instance family per Amazon account per Region. Quotas apply to running instances only. If your instance is pending, stopping, or stopped, it does not count towards your quota. To view the quotas for your account, or to request a quota increase, use the [ Service Quotas console](https://console.amazonaws.cn/servicequotas/home/services/ec2/quotas).
+ Auto Scaling groups are supported when using a launch template that specifies a host resource group. For more information, see [Create a launch template using advanced settings](https://docs.amazonaws.cn/autoscaling/ec2/userguide/advanced-settings-for-your-launch-template.html) in the *Amazon EC2 Auto Scaling User Guide*.
+ Amazon RDS instances are not supported.
+ The Amazon Free Usage tier is not available for Dedicated Hosts.
+ Instance placement control refers to managing instance launches onto Dedicated Hosts. You can't launch Dedicated Hosts into placement groups.
+ If you allocate a host for a virtualized instance type, you can't modify the instance type to a `.metal` instance type after the host is allocated. For example, if you allocate a host for the `m5.large` instance type, you can't modify the instance type to `m5.metal`.

  Similarly, if you allocate a host for a `.metal` instance type, you can't modify the instance type to a virtualized instance type after the host is allocated. For example, if you allocate a host for the `m5.metal` instance type, you can't modify the instance type to `m5.large`.

**Topics**
+ [

## Dedicated Hosts restrictions
](#dedicated-hosts-limitations)
+ [Pricing and billing](dedicated-hosts-billing.md)
+ [Instance capacity configurations](dedicated-hosts-limits.md)
+ [Burstable instances on Dedicated Hosts](burstable-t3.md)
+ [Bring your own licenses](dedicated-hosts-BYOL.md)
+ [Auto-placement and affinity](dedicated-hosts-understanding.md)
+ [Allocate a Dedicated Host](dedicated-hosts-allocating.md)
+ [Launch instances on a Dedicated Host](launching-dedicated-hosts-instances.md)
+ [Launch instances into a host resource group](launching-hrg-instances.md)
+ [Modify Dedicated Host auto-placement](modify-host-auto-placement.md)
+ [Modify supported instance types](modify-host-support.md)
+ [Modify tenancy and affinity for an instance](moving-instances-dedicated-hosts.md)
+ [Release Dedicated Host](dedicated-hosts-releasing.md)
+ [

# Migrate to Nitro-based Amazon EC2 Dedicated Hosts
](dh-migrate.md)
+ [Purchase a Dedicated Host Reservation](#purchasing-dedicated-host-reservations)
+ [Host recovery](dedicated-hosts-recovery.md)
+ [Host maintenance](dedicated-hosts-maintenance.md)
+ [Monitor Dedicated Hosts](dedicated-hosts-monitoring.md)
+ [Track configuration changes](dedicated-hosts-aws-config.md)

# Amazon EC2 Dedicated Host pricing and billing
Pricing and billing

The price for a Dedicated Host varies by payment option. For more information, see [Amazon EC2 Dedicated Host Pricing](https://www.amazonaws.cn/ec2/pricing/).

**Topics**
+ [

## On-Demand Dedicated Hosts
](#on-demand-dedicated-hosts)
+ [

## Dedicated Host Reservations
](#dedicated-host-reservations)

## On-Demand Dedicated Hosts




On-Demand billing is automatically activated when you allocate a Dedicated Host to your account.

The On-Demand price for a Dedicated Host varies by instance family and Region. You pay per second (with a minimum of 60 seconds) for active Dedicated Host, regardless of the quantity or the size of instances that you choose to launch on it. 



You can release an On-Demand Dedicated Host at any time to stop accruing charges for it. For information about releasing a Dedicated Host, see [Release an Amazon EC2 Dedicated Host](dedicated-hosts-releasing.md).

## Dedicated Host Reservations


Dedicated Host Reservations provide a billing discount compared to running On-Demand Dedicated Hosts. Reservations are available in three payment options:
+ **No Upfront**—No Upfront Reservations provide you with a discount on your Dedicated Host usage over a term and do not require an upfront payment. Available in one-year and three-year terms. Only some instance families support the three-year term for No Upfront Reservations.
+ **Partial Upfront**—A portion of the reservation must be paid upfront and the remaining hours in the term are billed at a discounted rate. Available in one-year and three-year terms.
+ **All Upfront**—Provides the lowest effective price. Available in one-year and three-year terms and covers the entire cost of the term upfront, with no additional future charges.

You must have active Dedicated Hosts in your account before you can purchase reservations. Each reservation can cover one or more hosts that support the same instance family in a single Availability Zone. Reservations are applied to the instance family on the host, not the instance size. If you have three Dedicated Hosts with different instances sizes (`m4.xlarge`, `m4.medium`, and `m4.large`) you can associate a single `m4` reservation with all those Dedicated Hosts. The instance family and Availability Zone of the reservation must match that of the Dedicated Hosts you want to associate it with. 

When a reservation is associated with a Dedicated Host, the Dedicated Host can't be released until the reservation's term is over.

# Amazon EC2 Dedicated Host instance capacity configurations
Instance capacity configurations

Dedicated Hosts support different configurations (physical cores, sockets, and VCPUs) that allow you to run instances of different families and sizes.

When you allocate a Dedicated Host in your account, you can choose a configuration that supports either a **single instance type**, or ** multiple instance types** within the same instance family. The number of instances that you can run on a host depends on the configuration you choose.

**Topics**
+ [

## Single instance type support
](#dh-single)
+ [

## Multiple instance type support
](#dh-multiple)

## Single instance type support


You can allocate a Dedicated Host that supports only one instance type. With this configuration, every instance that you launch on the Dedicated Host must be of the same instance type, which you specify when you allocate the host. 

For example, you can allocate a host that supports only the `m5.4xlarge` instance type. In this case, you can run only `m5.4xlarge` instances on that host.

The number of instances that you can launch onto the host depends on the number of physical cores provided by the host, and the number of cores consumed by the specified instance type. For example, if you allocate a host for `m5.4xlarge` instances, the host provides 48 physical cores, and each `m5.4xlarge` instance consumes 8 physical cores. This means that you can launch up to 6 instances on that host (*48 physical cores / 8 cores per instance = 6 instances*).

## Multiple instance type support


You can allocate a Dedicated Host that supports multiple instance types within the same instance family. This allows you to run different instance types on the same host, as long as they're in the same instance family and the host has sufficient instance capacity.

For example, you can allocate a host that supports different instance types within the `R5` instance family. In this case, you can launch certain combinations of `R5` instance types, such as `r5.large`, `r5.xlarge`, `r5.2xlarge`, and `r5.4xlarge`, on that host, within the host's physical core capacity.

The following instance families support Dedicated Hosts with multiple instance type support:
+ **General purpose:** A1 \$1 M5 \$1 M5n \$1 M6i \$1 M7i \$1 T3
+ **Compute optimized:** C5 \$1 C5n \$1 C6i \$1 C7i
+ **Memory optimized:** R5 \$1 R5n \$1 R6i \$1 R7i

The number of instances you can run on the host depends on the number of physical cores provided by the host, and the number of cores consumed by each instance type that you run on the host. For example, if you allocate an `R5` host, which provides 48 physical cores, and you run two `r5.2xlarge` instances (*4 cores x 2 instances*) and three `r5.4xlarge` instances (*8 cores x 3 instances*), those instances consume a total of 32 cores, and you might be able to run certain combinations of `R5` instances as long as they are within the remaining 16 cores.

However, for each instance family, there is a limit on the number of instances that can be run for each instance type. For example, an `R5` Dedicated Host supports a maximum of 2 `r5.8xlarge` instances, which uses 32 of the physical cores. In this case, additional `R5` instances of smaller types can then be used to fill the host to core capacity. For the supported number of instance types for each instance family, see the [Dedicated Hosts Configuration Table](https://www.amazonaws.cn/ec2/dedicated-hosts/pricing/#host-configuration).

The following table shows example instance type combinations:


| Instance family | Example instance type combinations | 
| --- | --- | 
| R5 |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/en_us/AWSEC2/latest/UserGuide/dedicated-hosts-limits.html)  | 
| C5 |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/en_us/AWSEC2/latest/UserGuide/dedicated-hosts-limits.html)  | 
| M5 |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/en_us/AWSEC2/latest/UserGuide/dedicated-hosts-limits.html)  | 

**Considerations**  
Keep the following in mind when working with Dedicated Hosts that support multiple instance types:
+ Using multiple instance types on the same host is possible only within the same instance family.
+ When mixing instance types, to maximize host utilization, we recommend launching larger instance types first followed by smaller instance types.
  + Depending on the combination and launch order of the instance types on a Dedicated Host, it may not be physically possible to maximize the utilization of the host. When mixing instance types on a host, some capacity might be available on the host but not usable. For example, you might see 16 vCPUs available on an r5n host but may not be able to launch a 4xlarge instance on the host even though r5n.4xlarge runs on 16 vCPUs.

**Note**  
If you enable an A1 Dedicated Host for multiple instance types, you can launch only a mix of `a1.xlarge` and `a1.2xlarge` instances on that host. If you launch an `a1.medium` or `a1.large` instance on that host, you will be restricted to launching only more of that same instance type on the host. A single `a1.4xlarge` instance consumes all capacity on the host. If you require a host for either `a1.medium` or `a1.large` instances, we recommend that you allocate separate hosts for those instance types.

# Burstable T3 instances on Amazon EC2 Dedicated Hosts
Burstable instances on Dedicated Hosts

Dedicated Hosts support burstable performance T3 instances. T3 instances provide a cost-efficient way of using your eligible BYOL license software on dedicated hardware. The smaller vCPU footprint of T3 instances enables you to consolidate your workloads on fewer hosts and maximize your per-core license utilization.

T3 Dedicated Hosts are best suited for running BYOL software with low to moderate CPU utilization. This includes eligible per-socket, per-core, or per-VM software licenses, such as Windows Server, Windows Desktop, SQL Server, SUSE Enterprise Linux Server, Red Hat Enterprise Linux, and Oracle Database. Examples of workloads suited for T3 Dedicated Hosts are small and medium databases, virtual desktops, development and test environments, code repositories, and product prototypes. T3 Dedicated Hosts are not recommended for workloads with sustained high CPU utilization or for workloads that experience correlated CPU bursts simultaneously.

T3 instances on Dedicated Hosts use the same credit model as T3 instances on shared tenancy hardware. However, they support the `standard` credit mode only; they do not support the `unlimited` credit mode. In `standard` mode, T3 instances on Dedicated Hosts *earn*, *spend*, and *accrue* credits in the same way as burstable instances on shared tenancy hardware. They provide a baseline CPU performance with the ability to burst above the baseline level. To burst above the baseline, the instance spends credits that it has accrued in its CPU credit balance. When the accrued credits are depleted, CPU utilization is lowered to the baseline level. For more information about `standard` mode, see [How standard burstable performance instances work](burstable-performance-instances-standard-mode-concepts.md#how-burstable-performance-instances-standard-works).

T3 Dedicated Hosts support all of the features offered by Amazon EC2 Dedicated Hosts, including multiple instance sizes on a single host, Host resource groups, and BYOL.

**Supported T3 instance sizes and configurations**  


T3 Dedicated Hosts run general purpose burstable T3 instances that share CPU resources of the host by providing a baseline CPU performance and the ability to burst to a higher level when needed. This enables T3 Dedicated Hosts, which have 48 cores, to support up to a maximum of 192 instances per host. In order to efficiently utilize the host’s resources and to provide the best instance performance, the Amazon EC2 instance placement algorithm automatically calculates the supported number of instances and instance size combinations that can be launched on the host.

T3 Dedicated Hosts support multiple instance types on the same host. All T3 instance sizes are supported on Dedicated Hosts. You can run different combinations of T3 instances up to the CPU limit of the host.

The following table lists the supported instance types, summarizes the performance of each instance type, and indicates the maximum number of instances of each size that can be launched.


| Instance type | vCPUs | Memory (GiB) | Baseline CPU utilization per vCPU | Network burst bandwidth (Gbps) | Amazon EBS burst bandwidth (Mbps) | Max number of instances per Dedicated Host | 
| --- | --- | --- | --- | --- | --- | --- | 
| t3.nano | 2 | 0.5 | 5% | 5 | Up to 2,085 | 192 | 
| t3.micro | 2 | 1 | 10% | 5 | Up to 2,085 | 192 | 
| t3.small | 2 | 2 | 20% | 5 | Up to 2,085 | 192 | 
| t3.medium | 2 | 4 | 20% | 5 | Up to 2,085 | 192 | 
| t3.large | 2 | 8 | 30% | 5 | 2,780 | 96 | 
| t3.xlarge | 4 | 16 | 40% | 5 | 2,780 | 48 | 
| t3.2xlarge | 8 | 32 | 40% | 5 | 2,780 | 24 | 

**Monitor CPU utilization for T3 Dedicated Hosts**  
You can use the `DedicatedHostCPUUtilization` Amazon CloudWatch metric to monitor the vCPU utilization of a Dedicated Host. The metric is available in the `EC2` namespace and `Per-Host-Metrics` dimension. For more information, see [Dedicated Host metrics](viewing_metrics_with_cloudwatch.md#dh-metrics).

# Bring your own software licenses to Amazon EC2 Dedicated Hosts
Bring your own licenses

Dedicated Hosts allow you to use your existing per-socket, per-core, or per-VM software licenses. When you bring your own license, you are responsible for managing your own licenses. However, Amazon EC2 has features that help you maintain license compliance, such as instance affinity and targeted placement.

These are the general steps to follow in order to bring your own volume licensed machine image into Amazon EC2.

1. Verify that the license terms controlling the use of your machine images allow usage in a virtualized cloud environment. For more information about Microsoft Licensing, see [Amazon Web Services and Microsoft Licensing](http://www.amazonaws.cn/windows/faq/#licensing).

1. After you have verified that your machine image can be used within Amazon EC2, import it using VM Import/Export. For information about how to import your machine image, see the [VM Import/Export User Guide](https://docs.amazonaws.cn/vm-import/latest/userguide/).

1. After you import your machine image, you can launch instances from it onto active Dedicated Hosts in your account.

1. When you run these instances, depending on the operating system, you might be required to activate these instances against your own KMS server (for example, Windows Server or Windows SQL Server). You can't activate your imported Windows AMI against the Amazon Windows KMS server.

**Note**  
To track how your images are used in Amazon, enable host recording in Amazon Config. You can use Amazon Config to record configuration changes to a Dedicated Host and use the output as a data source for license reporting. For more information, see [Track Amazon EC2 Dedicated Host configuration changes using Amazon Config](dedicated-hosts-aws-config.md). 

# Amazon EC2 Dedicated Host auto-placement and host affinity
Auto-placement and affinity

Placement control for Dedicated Hosts happens on both the instance level and host level.

## Auto-placement


Auto-placement is configured at the host level. It allows you to manage whether instances that you launch are launched onto a specific host, or onto any available host that has matching configurations.

When auto-placement is **disabled** for a Dedicated Host, it accepts only host tenancy instance launches that specify its unique host ID. This is the default setting for new Dedicated Hosts.

When auto-placement is **enabled** for a Dedicated Host, it accepts any untargeted, host tenancy instance launches that match its instance type configuration.

When launching an instance, you need to configure its tenancy. Launching an instance onto a Dedicated Host without providing a specific `HostId` enables it to launch on any Dedicated Host that has auto-placement *enabled* and that matches its instance type.

## Host affinity


Host affinity is configured at the instance level. It establishes a launch relationship between an instance and a Dedicated Host.

When affinity is set to `Host`, an instance launched onto a specific host always restarts on the same host if stopped. This applies to both targeted and untargeted launches.

When affinity is set to `Default`, and you stop and restart the instance, it can be restarted on any available host. However, it tries to launch back onto the last Dedicated Host on which it ran (on a best-effort basis).

# Allocate an Amazon EC2 Dedicated Host for use in your account
Allocate a Dedicated Host

To begin using a Dedicated Host, you must first allocate it in your account. After you allocate the Dedicated Host, the Dedicated Host capacity is made available in your account immediately and you can start launching instances onto the Dedicated Host.

When you allocate a Dedicated Host in your account, you can choose a configuration that supports either a **single instance type**, or ** multiple instance types** within the same instance family. The number of instances that you can run on the host depends on the configuration you choose. For more information see [Amazon EC2 Dedicated Host instance capacity configurations](dedicated-hosts-limits.md).

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

**To allocate a Dedicated Host**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. In the navigation pane, choose **Dedicated Hosts** and then choose **Allocate Dedicated Host**.

1. For **Instance family**, choose the instance family for the Dedicated Host.

1. Specify whether the Dedicated Host supports multiple instance sizes within the selected instance family, or a specific instance type only. Do one of the following.
   + To configure the Dedicated Host to support multiple instance types in the selected instance family, for **Support multiple instance types**, choose **Enable**. Enabling this allows you to launch different instance sizes from the same instance family onto the Dedicated Host. For example, if you choose the `m5` instance family and choose this option, you can launch `m5.xlarge` and `m5.4xlarge` instances onto the Dedicated Host.
   + To configure the Dedicated Host to support a single instance type within the selected instance family, clear **Support multiple instance types**, and then for **Instance type**, choose the instance type to support. This allows you to launch a single instance type on the Dedicated Host. For example, if you choose this option and specify `m5.4xlarge` as the supported instance type, you can launch only `m5.4xlarge` instances onto the Dedicated Host.

1. For **Availability Zone**, choose the Availability Zone in which to allocate the Dedicated Host.

1. To allow the Dedicated Host to accept untargeted instance launches that match its instance type, for **Instance auto-placement**, choose **Enable**. For more information about auto-placement, see [Amazon EC2 Dedicated Host auto-placement and host affinity](dedicated-hosts-understanding.md).

1. To enable host recovery for the Dedicated Host, for **Host recovery**, choose **Enable**. For more information, see [Amazon EC2 Dedicated Host recovery](dedicated-hosts-recovery.md).

1. For **Quantity**, enter the number of Dedicated Hosts to allocate.

1. (Optional) Choose **Add new tag** and enter a tag key and a tag value.

1. Choose **Allocate**.

------
#### [ Amazon CLI ]

**To allocate a Dedicated Host**  
Use the [allocate-hosts](https://docs.amazonaws.cn/cli/latest/reference/ec2/allocate-hosts.html) command. The following example allocates a Dedicated Host that supports multiple instance types from the `m5` instance family in the `us-east-1a` Availability Zone. It also enables host recovery and disables auto-placement.

```
aws ec2 allocate-hosts \
    --instance-family "m5" \
    --availability-zone "us-east-1a" \
    --auto-placement "off" \
    --host-recovery "on" \ 
    --quantity 1
```

The following example allocates a Dedicated Host that supports *untargeted* instance launches in the specified Availability Zone, enables host recovery, and enables auto-placement.

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

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

**To allocate a Dedicated Host**  
Use the [New-EC2Host](https://docs.amazonaws.cn/powershell/latest/reference/items/New-EC2Host.html) cmdlet. The following example allocates a Dedicated Host that supports multiple instance types from the `m5` instance family in the `us-east-1a` Availability Zone. The host also has host recovery enabled and auto-placement disabled.

```
New-EC2Host `
    -InstanceFamily m5 `
    -AvailabilityZone us-east-1a `
    -AutoPlacement Off `
    -HostRecovery On `
    -Quantity 1
```

The following example allocates a Dedicated Host that supports *untargeted* instance launches in the specified Availability Zone and enables host recovery.

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

------

# Launch Amazon EC2 instances on an Amazon EC2 Dedicated Host
Launch instances on a Dedicated Host

After you have allocated a Dedicated Host, you can launch instances onto it. You can't launch instances with `host` tenancy if you do not have active Dedicated Hosts with enough available capacity for the instance type that you are launching.

**Considerations**
+ SQL Server, SUSE, and RHEL AMIs provided by Amazon EC2 can't be used with Dedicated Hosts.
+ For Dedicated Hosts that support multiple instance sizes, we recommend that you launch the larger instance sizes first, and then fill the remaining instance capacity with the smaller instance sizes as needed.
+ Before you launch your instances, take note of the limitations. For more information, see [Dedicated Hosts restrictions](dedicated-hosts-overview.md#dedicated-hosts-limitations).

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

**To launch an instance onto a specific Dedicated Host from the Dedicated Hosts page**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. Choose **Dedicated Hosts** in the navigation pane.

1. On the **Dedicated Hosts** page, select a host and choose **Actions**, **Launch Instance(s) onto host**.

1. In the **Application and OS Images** section, select an AMI from the list.

1. In the **Instance type** section, select the instance type to launch.
**Note**  
If the Dedicated Host supports a single instance type only, the supported instance type is selected by default and can't be changed.  
If the Dedicated Host supports multiple instance types, you must select an instance type within the supported instance family based on the available instance capacity of the Dedicated Host. We recommend that you launch the larger instance sizes first, and then fill the remaining instance capacity with the smaller instance sizes as needed.

1. In the **Key pair** section, select the key pair to associate with the instance.

1. In the **Advanced details** section, for **Tenancy affinity**, choose one of the following:
   + **Off** — Host affinity disabled. The instance launches onto the specified host, but it is not guaranteed to restart on the same Dedicated Host if stopped.
   + A Dedicated Host ID — Host affinity enabled. If stopped, the instance always restarts on this specified host if it has capacity. If the host does not have capacity, the instance can't be restarted; you must establish affinity with a different host.

   For more information about Affinity, see [Amazon EC2 Dedicated Host auto-placement and host affinity](dedicated-hosts-understanding.md).
**Note**  
The **Tenancy** and **Host** options are pre-configured based on the host that you selected.

1. Configure the remaining instance options as needed. For more information, see [Reference for Amazon EC2 instance configuration parameters](ec2-instance-launch-parameters.md).

1. Choose **Launch instance**.

**To launch an instance onto a Dedicated Host using the Launch Instance wizard**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. In the navigation pane, choose **Instances**, **Launch instance**.

1. In the **Application and OS Images** section, select an AMI from the list.

1. In the **Instance type** section, select the instance type to launch.

1. In the **Key pair** section, select the key pair to associate with the instance.

1. In the **Advanced details** section, do the following:

   1. For **Tenancy**, select **Dedicated Host**.

   1. For **Target host by**, select **Host ID**.

   1. For **Target host ID**, select the host onto which to launch the instance.

   1. For **Tenancy affinity**, choose one of the following:
      + **Off** — Host affinity disabled. The instance launches onto the specified host, but it is not guaranteed to restart on the same Dedicated Host if stopped.
      + A Dedicated Host ID — Host affinity enabled. If stopped, the instance always restarts on this specified host if it has capacity. If the host does not have capacity, the instance can't be restarted; you must establish affinity with a different host.

      For more information about Affinity, see [Amazon EC2 Dedicated Host auto-placement and host affinity](dedicated-hosts-understanding.md).

1. Configure the remaining instance options as needed. For more information, see [Reference for Amazon EC2 instance configuration parameters](ec2-instance-launch-parameters.md).

1. Choose **Launch instance**.

------
#### [ Amazon CLI ]

**To launch an instance onto a Dedicated Host**  
Use the [run-instances](https://docs.amazonaws.cn/cli/latest/reference/ec2/run-instances.html) command and specify the instance affinity, tenancy, and host in the `--placement` option.

To launch onto a specific Dedicated Host with host affinity (instance always restarts on the same host if stopped):

```
--placement Affinity=host,Tenancy=host,HostId=h-07879acf49EXAMPLE
```

To launch onto a specific Dedicated Host without host affinity (instance can restart on any available host):

```
--placement Tenancy=host,HostId=h-07879acf49EXAMPLE
```

To launch onto any available Dedicated Host with auto-placement enabled and matching instance type:

```
--placement Tenancy=host
```

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

**To launch an instance onto a Dedicated Host**  
Use the [New-EC2Instance](https://docs.amazonaws.cn/powershell/latest/reference/items/New-EC2Instance.html) cmdlet and specify the instance affinity, tenancy, and host in the `-Placement` parameter.

To launch onto a specific Dedicated Host with host affinity (instance always restarts on the same host if stopped):

```
-Placement_Affinity host `
-Placement_Tenancy host `
-Placement_HostId h-07879acf49EXAMPLE
```

To launch onto a specific Dedicated Host without host affinity (instance can restart on any available host):

```
-Placement_Tenancy host `
-Placement_HostId h-07879acf49EXAMPLE
```

To launch onto any available Dedicated Host with auto-placement enabled and matching instance type:

```
-Placement_Tenancy host
```

------

# Launch Amazon EC2 instances into a host resource group
Launch instances into a host resource group

Dedicated Hosts are also integrated with Amazon License Manager. With License Manager, you can create a host resource group, which is a collection of Dedicated Hosts that are managed as a single entity. When creating a host resource group, you specify the host management preferences, such as auto-allocate and auto-release, for the Dedicated Hosts. This allows you to launch instances onto Dedicated Hosts without manually allocating and managing those hosts. For more information, see [ Host Resource Groups](https://docs.amazonaws.cn/license-manager/latest/userguide/host-resource-groups.html) in the *Amazon License Manager User Guide*.

When you launch an instance into a host resource group that has a Dedicated Host with available instance capacity, Amazon EC2 launches the instance onto that host. If the host resource group does not have a host with available instance capacity, Amazon EC2 automatically allocates a new host in the host resource group, and then launches the instance onto that host. For more information, see [ Host Resource Groups](https://docs.amazonaws.cn/license-manager/latest/userguide/host-resource-groups.html) in the *Amazon License Manager User Guide*.

**Requirements and limits**
+ You must associate a core- or socket-based license configuration with the AMI.
+ You can't use SQL Server, SUSE, or RHEL AMIs provided by Amazon EC2 with Dedicated Hosts.
+ You can't target a specific host by choosing a host ID, and you can't enable instance affinity when launching an instance into a host resource group.

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

**To launch an instance into a host resource group**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. In the navigation pane, choose **Instances**, **Launch instance**.

1. In the **Application and OS Images** section, select an AMI from the list.

1. In the **Instance type** section, select the instance type to launch.

1. In the **Key pair** section, select the key pair to associate with the instance.

1. In the **Advanced details** section, do the following:

   1. For **Tenancy**, select **Dedicated Host**.

   1. For **Target host by**, select **Host resource group**.

   1. For **Tenancy host resource group**, select the host resource group into which to launch the instance.

   1. For **Tenancy affinity**, do one of the following:
      + Select **Off** — The instance launches onto the specified host, but it is not guaranteed to restart on the same Dedicated Host if stopped.
      + Select the Dedicated Host ID — If stopped, the instance always restarts on this specific host. 

      For more information about Affinity, see [Amazon EC2 Dedicated Host auto-placement and host affinity](dedicated-hosts-understanding.md).

1. Configure the remaining instance options as needed. For more information, see [Reference for Amazon EC2 instance configuration parameters](ec2-instance-launch-parameters.md).

1. Choose **Launch instance**.

------
#### [ Amazon CLI ]

**To launch an instance into a host resource group**  
Use the [run-instances](https://docs.amazonaws.cn/cli/latest/reference/ec2/run-instances.html) command. In the `--placement` option, omit the tenancy and specify the ARN of the host resource group.

```
--placement HostResourceGroupArn=arn:aws-cn:resource-groups:us-east-2:123456789012:group/my-resource-group
```

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

**To launch an instance into a host resource group**  
Use the [New-EC2Instance](https://docs.amazonaws.cn/powershell/latest/reference/items/New-EC2Instance.html) cmdlet. In the `-Placement` parameter, omit the tenancy and specify the ARN of the host resource group.

```
-Placement_HostResourceGroupArn arn:aws-cn:resource-groups:us-east-2:123456789012:group/my-resource-group
```

------

# Modify the auto-placement setting for an existing Amazon EC2 Dedicated Host
Modify Dedicated Host auto-placement

You can modify the auto-placement settings of a Dedicated Host after you have allocated it to your Amazon account.

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

**To modify the auto-placement of a Dedicated Host**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

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

1. Select a host and choose **Actions**, **Modify host**.

1. For **Instance auto-placement**, choose **Enable** to enable auto-placement, or clear **Enable** to disable auto-placement. For more information, see [Amazon EC2 Dedicated Host auto-placement and host affinity](dedicated-hosts-understanding.md).

1. Choose **Save**.

------
#### [ Amazon CLI ]

**To modify the auto-placement of a Dedicated Host**  
Use the [modify-hosts](https://docs.amazonaws.cn/cli/latest/reference/ec2/modify-hosts.html) command.

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

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

**To modify the auto-placement of a Dedicated Host**  
Use the [Edit-EC2Host](https://docs.amazonaws.cn/powershell/latest/reference/items/Edit-EC2Host.html) cmdlet.

```
Edit-EC2Host `
    -AutoPlacement 1 `
    -HostId h-012a3456b7890cdef
```

------

# Modify supported instance types for an existing Amazon EC2 Dedicated Host
Modify supported instance types

You can modify a Dedicated Host to change the instance types that it supports. If it currently supports a single instance type, you can modify it to support multiple instance types within that instance family. Similarly, if it currently supports multiple instance types, you can modify it to support a specific instance type only.

To modify a Dedicated Host to support multiple instance types, you must first stop all running instances on the host. The modification takes approximately 10 minutes to complete. The Dedicated Host transitions to the `pending` state while the modification is in progress. You can't start stopped instances or launch new instances on the Dedicated Host while it is in the `pending` state.

To modify a Dedicated Host that supports multiple instance types to support only a single instance type, the host must either have no running instances, or the running instances must be of the instance type that you want the host to support. For example, to modify a host that supports multiple instance types in the `m5` instance family to support only `m5.large` instances, the Dedicated Host must either have no running instances, or it must have only `m5.large` instances running on it.

If you allocate a host for a virtualized instance type, you can't modify the instance type to a `.metal` instance type after the host is allocated. For example, if you allocate a host for the `m5.large` instance type, you can't modify the instance type to `m5.metal`. Similarly, if you allocate a host for a `.metal` instance type, you can't modify the instance type to a virtualized instance type after the host is allocated. For example, if you allocate a host for the `m5.metal` instance type, you can't modify the instance type to `m5.large`.

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

**To modify the supported instance types for a Dedicated Host**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. In the Navigation pane, choose **Dedicated Host**.

1. Select the Dedicated Host to modify and choose **Actions**, **Modify host**.

1. Do one of the following, depending on the current configuration of the Dedicated Host:
   + If the Dedicated Host currently supports a specific instance type, **Support multiple instance types** is not enabled, and **Instance type** lists the supported instance type. To modify the host to support multiple types in the current instance family, for **Support multiple instance types**, choose **Enable**.

     You must first stop all instances running on the host before modifying it to support multiple instance types.
   + If the Dedicated Host currently supports multiple instance types in an instance family, **Enabled** is selected for **Support multiple instance types**. To modify the host to support a specific instance type, for **Support multiple instance types**, clear **Enable**, and then for **Instance type**, select the specific instance type to support.

     You can't change the instance family supported by the Dedicated Host.

1. Choose **Save**.

------
#### [ Amazon CLI ]

**To modify the supported instance types for a Dedicated Host**  
Use the [modify-hosts](https://docs.amazonaws.cn/cli/latest/reference/ec2/modify-hosts.html) command.

The following example modifies a Dedicated Host to support multiple instance types within the `m5` instance family.

```
aws ec2 modify-hosts \
    --instance-family m5 \
    --host-ids h-012a3456b7890cdef
```

The following example modifies a Dedicated Host to support `m5.xlarge` instances only.

```
aws ec2 modify-hosts \
    --instance-type m5.xlarge \
    --instance-family --host-ids h-012a3456b7890cdef
```

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

**To modify the supported instance types for a Dedicated Host**  
Use the [Edit-EC2Host](https://docs.amazonaws.cn/powershell/latest/reference/items/Edit-EC2Host.html) cmdlet.

The following example modifies a Dedicated Host to support multiple instance types within the `m5` instance family.

```
Edit-EC2Host `
    -InstanceFamily m5 `
    -HostId h-012a3456b7890cdef
```

The following example modifies a Dedicated Host to support `m5.xlarge` instances only.

```
Edit-EC2Host `
    -InstanceType m5.xlarge `
    -HostId h-012a3456b7890cdef
```

------

# Modify Amazon EC2 Dedicated Host tenancy and affinity for an Amazon EC2 instance
Modify tenancy and affinity for an instance

You can change the tenancy of an instance after you have launched it. You can also modify the affinity for your instance to target a specific host or allow it to launch on any available dedicated host with matching attributes in your account. To modify either instance tenancy or affinity, the instance must be in the `stopped` state. 

The operating system details of your instance—and whether SQL Server is installed—affect what conversions are supported. For more information about the tenancy conversion paths available to your instance, see [Tenancy conversion](https://docs.amazonaws.cn/license-manager/latest/userguide/conversion-tenancy.html) in the *License Manager User Guide*.

**Note**  
For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of `host`. For T3 instances, you can't change the tenancy from `host` to `dedicated` or `default`. Attempting to make one of these unsupported tenancy changes results in an `InvalidRequest` error code.

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

**To modify instance tenancy or affinity**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. Choose **Instances**, and select the instance to modify.

1. Choose **Instance state**, **Stop**.

1. With the instance selected, choose **Actions**, **Instance settings**, **Modify instance placement**.

1. On the **Modify instance placement** page, configure the following:
   + **Tenancy**—Choose one of the following:
     + Run a dedicated hardware instance—Launches the instance as a Dedicated Instance. For more information, see [Amazon EC2 Dedicated Instances](dedicated-instance.md).
     + Launch the instance on a Dedicated Host—Launches the instance onto a Dedicated Host with configurable affinity.
   + **Affinity**—Choose one of the following:
     + This instance can run on any one of my hosts—The instance launches onto any available Dedicated Host in your account that supports its instance type.
     + This instance can only run on the selected host—The instance is only able to run on the Dedicated Host selected for **Target Host**.
   + **Target Host**—Select the Dedicated Host that the instance must run on. If no target host is listed, you might not have available, compatible Dedicated Hosts in your account.

   For more information, see [Amazon EC2 Dedicated Host auto-placement and host affinity](dedicated-hosts-understanding.md).

1. Choose **Save**.

------
#### [ Amazon CLI ]

**To modify instance tenancy or affinity**  
Use the [modify-instance-placement](https://docs.amazonaws.cn/cli/latest/reference/ec2/modify-instance-placement.html) command. The following example changes the specified instance's affinity from `default` to `host`, and specifies the Dedicated Host that the instance has affinity with.

```
aws ec2 modify-instance-placement \
    --instance-id i-1234567890abcdef0 \
    --affinity host \
    --tenancy host \
    --host-id h-012a3456b7890cdef
```

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

**To modify instance tenancy or affinity**  
Use the [Edit-EC2InstancePlacement](https://docs.amazonaws.cn/powershell/latest/reference/items/Edit-EC2InstancePlacement.html) cmdlet. The following example changes the specified instance's affinity from `default` to `host`, and specifies the Dedicated Host that the instance has affinity with.

```
Edit-EC2InstancePlacement `
    -InstanceId i-1234567890abcdef0 `
    -Affinity host `
    -Tenancy host `
    -HostId h-012a3456b7890cdef
```

------

# Release an Amazon EC2 Dedicated Host
Release Dedicated Host

If you no longer need Dedicated Host, you can stop the instances running on the host, direct them to launch on a different host, and then *release* the host.

Any running instances on the Dedicated Host must be stopped before you can release the host. These instances can be migrated to other Dedicated Hosts in your account so that you can continue to use them. These steps apply only to On-Demand Dedicated Hosts.

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

**To release a Dedicated Host**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

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

1. On the **Dedicated Hosts** page, select the Dedicated Host to release.

1. Choose **Actions**, **Release host**.

1. To confirm, choose **Release**.

------
#### [ Amazon CLI ]

**To release a Dedicated Host**  
Use the [release-hosts](https://docs.amazonaws.cn/cli/latest/reference/ec2/release-hosts.html) command.

```
aws ec2 release-hosts --host-ids h-012a3456b7890cdef
```

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

**To release a Dedicated Host**  
Use the [Remove-EC2Host](https://docs.amazonaws.cn/powershell/latest/reference/items/Remove-EC2Host.html) cmdlet.

```
Remove-EC2Host -HostId h-012a3456b7890cdef
```

------

After you release a Dedicated Host, you can't reuse the same host or host ID again, and you are no longer charged On-Demand billing rates for it. The state of the Dedicated Host is changed to `released`, and you are not able to launch any instances onto that host.

**Note**  
If you have recently released Dedicated Hosts, it can take some time for them to stop counting towards your limit. During this time, you might experience `LimitExceeded` errors when trying to allocate new Dedicated Hosts. If this is the case, try allocating new hosts again after a few minutes.

The instances that were stopped are still available for use and are listed on the **Instances** page. They retain their `host` tenancy setting.

# Migrate to Nitro-based Amazon EC2 Dedicated Hosts


The Nitro System is a collection of hardware and software components built by Amazon that enable high performance, high availability, and high security. Nitro-based Dedicated Hosts offer improved price performance compared to Xen-based Dedicated Hosts. If you have any Xen-based Dedicated Hosts in your account, we recommend that you migrate your workloads to Nitro-based Dedicated Hosts. For more information, see [Amazon Nitro System](https://www.amazonaws.cn/ec2/nitro/).

To migrate from a Xen-based Dedicated Host to a Nitro-based Dedicated Host, you need to migrate the Xen-based instances on your Dedicated Host to Nitro-based instance types, allocate a new Nitro-based Dedicated Host, and then move your migrated Nitro-based instances to your new Nitro-based Dedicated Host. 

This topic provides detailed steps for migrating from Xen-based Dedicated Hosts to Nitro-based Dedicated Hosts.

**Topics**
+ [

## Step 1: Identify your Xen-based Dedicated Hosts
](#identify-xen-hosts)
+ [

## Step 2: Migrate Xen-based instances to Nitro-based instance types
](#migrate-dh-instances)
+ [

## Step 3: Allocate a Nitro-based Dedicated Host
](#allocate-nitro-host)
+ [

## Step 4: Move migrated instances to new Nitro-based Dedicated Host
](#move-instances)
+ [

## Step 5: Release unused Xen-based Dedicated Host
](#release-xen-instances)

## Step 1: Identify your Xen-based Dedicated Hosts


The following Dedicated Hosts are Xen-based and are eligible to be migrated to Nitro-based Dedicated Hosts.
+ **General purpose: **M3 \$1 M4
+ **Compute optimized: **C3 \$1 C4
+ **Memory optimized: **R3 \$1 R4 \$1 X1 \$1 X1e
+ **Storage optimized: **D2 \$1 H1 \$1 I2 \$1 I3
+ **Accelerated computing: **F1 \$1 G3 \$1 P2 \$1 P3

**To check if you have Xen-based Dedicated Hosts in your account**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

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

1. In the **Search field**, use the **Instance family** filter to search for the Xen-based Dedicated Hosts above. For example, *Instance family = m3*.

## Step 2: Migrate Xen-based instances to Nitro-based instance types


Instances that run on Xen-based Dedicated Hosts are also Xen-based. You must migrate these instances to Nitro-based instance types before you can move them to Nitro-based Dedicated Hosts.

**Important**  
Before you begin migrating your instances, we recommend that you back up your data. For more information, see [Create multi-volume Amazon EBS snapshots from an Amazon EC2 instance](https://docs.amazonaws.cn/ebs/latest/userguide/ebs-create-snapshots.html).

**To find instances running on your Xen-based Dedicated Hosts**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

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

1. Select the Xen-based host you intend to migrate and then select the **Running instances** tab. The tab lists all of the instances running of the selected host.

To migrate **Linux instances**, see [Amazon EC2 instance type changes](ec2-instance-resize.md).

To migrate **Windows instances**, see [Migrate an EC2 Windows instance to a Nitro-based instance type](migrating-latest-types.md).

**Note**  
Ensure that you migrate your instances to an instance type that matches the Nitro-based Dedicated Host that you intend to migrate to. For example, if you intend to migrate to a M7i Dedicated Host, ensure that you migrate your instances to an M7i instance type.

## Step 3: Allocate a Nitro-based Dedicated Host


**To find supported Nitro-based Dedicated Hosts**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. In the navigation panel, select **Instance Types**.

1. Apply the following filters:
   + *Hypervisor = nitro*
   + *Dedicated Host support = true*

After you've found a suitable Nitro-based instance type, [ allocate a new Dedicated Host](dedicated-hosts-allocating.md).

## Step 4: Move migrated instances to new Nitro-based Dedicated Host


After you have allocated the Nitro-based Dedicated Host and it reaches the `available` state, you can move the instances that you previously migrated to Nitro-based instance types to the new Dedicated Host.

**To move your instances to your new Nitro-based Dedicated Host**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. In the navigation panel, **Instances**.

1. Select the instance that you migrated and choose **Actions**, **Instance settings**, **Modify instance placement**.

1. For **Target dedicated host**, select the new Nitro-based Dedicated Host, and then choose **Save**.

1. Restart the instance. Select the instance and choose **Instance state**, **Start instance**.

## Step 5: Release unused Xen-based Dedicated Host


After you have migrated your workloads from the Xen-based Dedicated Host to the new Nitro-based Dedicated Host, you can [release the Xen-based Dedicated Host](dedicated-hosts-releasing.md) if you no longer need it.

## Purchase Dedicated Host Reservations for Dedicated Host billing discounts
Purchase a Dedicated Host Reservation

Dedicated Host Reservations provide you with a discount of up to 70 percent compared to On-Demand Dedicated Host pricing. You must have active Dedicated Hosts allocated in your account before you can purchase Dedicated Host Reservations. For more information, see [Dedicated Host Reservations](dedicated-hosts-billing.md#dedicated-host-reservations).

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

**To purchase reservations**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. Choose **Dedicated Hosts**, **Dedicated Host Reservations**, **Purchase Dedicated Host Reservation**.

1. On the **Find offerings** screen, do the following:

   1. For **Instance family**, select the instance family of the Dedicated Host for which to purchase the Dedicated Host Reservation.

   1. For **Payment option**, select and configure your preferred payment option.

1. Choose **Next**.

1. Select the Dedicated Hosts with which to associate the Dedicated Host Reservation, and then choose **Next**.

1. (*Optional*) Assign tags to the Dedicated Host Reservation.

1. Review your order and choose **Purchase**.

------
#### [ Amazon CLI ]

**To purchase reservations**

1. Use the [describe-host-reservation-offerings](https://docs.amazonaws.cn/cli/latest/reference/ec2/describe-host-reservation-offerings.html) command to list the available offerings that match your needs. The following example lists the offerings that support instances in the `m4` instance family and have a one-year term.

   The term is specified in seconds. A one-year term includes 31,536,000 seconds, and a three-year term includes 94,608,000 seconds.

   ```
   aws ec2 describe-host-reservation-offerings \
       --filter Name=instance-family,Values=m4 \
       --max-duration 31536000
   ```

   The command returns a list of offerings that match your criteria. Note the ID of the offering to purchase.

1. Use the [purchase-host-reservation](https://docs.amazonaws.cn/cli/latest/reference/ec2/purchase-host-reservation.html) command to purchase the offering and provide the `offeringId` noted in the previous step. The following example purchases the specified reservation and associates it with a specific Dedicated Host that is already allocated in the Amazon account, and it applies a tag with a key of `purpose` and a value of `production`.

   ```
   aws ec2 purchase-host-reservation \
       --offering-id hro-03f707bf363b6b324 \
       --host-id-set h-013abcd2a00cbd123 \
       --tag-specifications 'ResourceType=host-reservation,Tags={Key=purpose,Value=production}'
   ```

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

**To purchase reservations**

1. Use the [Get-EC2HostReservationOffering](https://docs.amazonaws.cn/powershell/latest/reference/items/Get-EC2HostReservationOffering.html) cmdlet to list the available offerings that match your needs. The following examples list the offerings that support instances in the `m5` instance family and have a one-year term.

   The term is specified in seconds. A one-year term includes 31,536,000 seconds, and a three-year term includes 94,608,000 seconds.

   ```
   $filter = @{Name="instance-family"; Values="m5"}
   Get-EC2HostReservationOffering `
       -Filter $filter `
       -MaxDuration 31536000
   ```

   The command returns a list of offerings that match your criteria. Note the ID of the offering to purchase.

1. Use the [New-EC2HostReservation](https://docs.amazonaws.cn/powershell/latest/reference/items/New-EC2HostReservation.html) cmdlet to purchase the offering and provide the offering ID noted in the previous step. The following example purchases the specified reservation and associates it with a specific Dedicated Host that is already allocated in the Amazon account.

   ```
   New-EC2HostReservation `
       -OfferingId hro-03f707bf363b6b324 `
       -HostIdSet h-013abcd2a00cbd123
   ```

------

# Amazon EC2 Dedicated Host recovery
Host recovery

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
How host recovery works

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


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 Amazon License Manager automates the tracking and management of your licenses.

**Note**  
Amazon License Manager integration is supported only in Regions in which Amazon 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 Amazon account owner is notified by email and by an Amazon Health Dashboard event. A second notification is sent after the host recovery has been successfully completed. 

If you are using Amazon License Manager to track your licenses, Amazon 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 Amazon 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.amazonaws.cn/license-manager/latest/userguide/license-configurations.html) and [Settings in License Manager](https://docs.amazonaws.cn/license-manager/latest/userguide/settings.html) in the *Amazon License Manager User Guide*.

## Host recovery states


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


**Dedicated Host auto recovery does not occur when the host is scheduled for retirement**. You will receive a retirement notification in the Amazon Health Dashboard, an Amazon CloudWatch event, and the Amazon 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


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


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](http://www.amazonaws.cn/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
Manage host recovery

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).

------
#### [ Amazon CLI ]

**To enable host recovery at allocation**  
Use the [allocate-hosts](https://docs.amazonaws.cn/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.amazonaws.cn/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.amazonaws.cn/ec2/](https://console.amazonaws.cn/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**.

------
#### [ Amazon CLI ]

**To enable host recovery after allocation**  
Use the [modify-hosts](https://docs.amazonaws.cn/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.amazonaws.cn/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.amazonaws.cn/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.amazonaws.cn/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
View host recovery setting

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.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

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

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

------
#### [ Amazon CLI ]

**To view the host recovery configuration for a Dedicated Host**  
Use the [describe-hosts](https://docs.amazonaws.cn/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.amazonaws.cn/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
Manually recovery unsupported instances

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


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


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.

# Host maintenance for Amazon EC2 Dedicated Host
Host maintenance

With host maintenance, in the rare event that a Dedicated Host becomes degraded, we automatically migrate instances running on it onto a healthy replacement Dedicated Host. This helps to minimize the downtime for your workload, and simplify the management of your Dedicated Hosts. Host maintenance is also performed for planned and routine Amazon EC2 maintenance.

Amazon EC2 supports two types of host maintenance:
+ **Live migration host maintenance** — Instances are automatically migrated to the replacement host within 24 hours, without stopping and restarting them.
+ **Reboot-based host maintenance** — Instances are scheduled for *instance reboot* scheduled events, during which they are automatically stopped and restarted on the replacement host.

**Topics**
+ [

## Host maintenance versus host recovery
](#dedicated-hosts-maintenance-differences)
+ [

## Considerations
](#dedicated-hosts-maintenance-basics-limitations)
+ [

## Related services
](#dedicated-hosts-maintenance-related)
+ [

## Pricing
](#dedicated-hosts-maintenance-pricing)
+ [

# How host maintenance works for Amazon EC2 Dedicated Hosts
](dedicated-hosts-maintenance-basics.md)
+ [

# Configure the host maintenance setting for an Amazon EC2 Dedicated Host
](dedicated-hosts-maintenance-configuring.md)

## Host maintenance versus host recovery


The following table shows the main differences between host recovery and host maintenance.


****  

|  | Host recovery | Host maintenance | 
| --- | --- | --- | 
| Instance reachability | Unreachable | Reachable | 
| Dedicated Host state | under-assessment | permanent-failure | 
| Host resource group | Supported | Not supported | 

For more information about host recovery, see [Host recovery](dedicated-hosts-recovery.md).

## Considerations

+ Host maintenance is available in all Amazon Web Services Regions, except the China Regions and Amazon GovCloud (US) Regions.
+ Host maintenance is not supported in Amazon Outposts, Amazon Local Zones, and Amazon Wavelength Zones.
+ Host maintenance can't be turned on or off for hosts already within a host resource group. Hosts added to a host resource group retain their host maintenance setting. For more information, see [Host resource groups](https://docs.amazonaws.cn/license-manager/latest/userguide/host-resource-groups.html).
+ Host maintenance is not supported with the following instance types, because they have instance store root volumes: C1, C3, D2, I2, M1, M2, M3, R3, and X1.

## Related services


Dedicated Host integrates with **Amazon License Manager**—Tracks licenses across your Amazon EC2 Dedicated Hosts (supported only in Regions in which Amazon License Manager is available). For more information, see the [Amazon License Manager User Guide](https://docs.amazonaws.cn/license-manager/latest/userguide/license-manager.html).

You must have sufficient licenses in your Amazon Web Services account for your new Dedicated Host. The licenses associated with your degraded host are released when the host is released after the completion of the scheduled event.

## Pricing


There are no additional charges for using host maintenance, but the usual Dedicated Host charges apply. For more information, see [ Amazon EC2 Dedicated Hosts Pricing](http://www.amazonaws.cn/ec2/dedicated-hosts/pricing/).

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

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

# How host maintenance works for Amazon EC2 Dedicated Hosts
How host maintenance works

When a degradation is detected on a Dedicated Host that is enabled for host maintenance, we automatically allocate a replacement Dedicated Host in your account. The replacement Dedicated Host receives a new host ID, but retains the same attributes as the original Dedicated Host, including:
+ Auto placement settings
+ Availability Zone
+ Dedicated Host Reservation association
+ Host affinity
+ Host maintenance settings
+ Host recovery settings
+ Instance type
+ Tags

After the replacement host has been allocated, we migrate the instances using either **live migration host maintenance** or **reboot-based host maintenance**, depending on the instance.

After the degraded host has no more running instances, it is permanently released from your account.

## Live migration host maintenance


Instances that require live migration host maintenance are automatically migrated to the replacement host within 24 hours, without stopping and restarting them. The migrated instances retain their existing attributes, including:
+ Instance ID
+ Instance metadata
+ Amazon EBS volume attachments
+ Elastic IP addresses and private IP address
+ Memory, CPU, and networking states

Some larger instance sizes might experience a slight performance decrease during the migration.

After the instances are automatically migrated to the replacement host, we send you email and Amazon Health Dashboard notifications. Notifications include the IDs of the degraded and replacement hosts, information about the instances that were automatically migrated using live migration host maintenance, and information about the remaining instances.

## Reboot-based host maintenance


Instances that require reboot-based host maintenance are scheduled for instance reboot scheduled events for 14 days from the date of the notification. You can continue to access your instances on the degraded Dedicated Host before the scheduled event.

You can reschedule reboot events for a date that is within 7 days of the original event date and time. For more information, see [Reschedule a scheduled event for an EC2 instance](reschedule-event.md).

Amazon EC2 automatically reserves capacity on the replacement host for these instances. You can't run instances in this reserved capacity.

The Amazon EC2 console shows the reserved capacity as used capacity. It could appear that the instances are running on both the degraded host and the replacement host. However, the instances will continue to run only on the degraded host until they are stopped or they are migrated into the reserved capacity on the replacement host.

At the date and time of the scheduled event, the instances are automatically stopped and restarted into the reserved capacity on the replacement host. The migrated instances retain their existing attributes, including:
+ Instance ID
+ Instance metadata
+ Amazon EBS volume attachments
+ Elastic IP addresses and private IP address

However, since the instances are stopped and restarted during the migration, they do not retain their memory, CPU, and networking states.

You can also manually stop and restart these instances at any time before the scheduled event to migrate them to the replacement host or to a different host. You might need to modify your instance's host affinity to restart it on a different host. If you stop an instance before the scheduled event, the reserved capacity on the replacement host is released and becomes available for use.

## Host maintenance states


When a host becomes degraded, it enters the `permanent-failure` state. You can't launch instances on a Dedicated Host that is in the `permanent-failure` state.

After the replacement host is allocated, it remains in the `pending` state until the instances that support live migration host maintenance are automatically migrated from the degraded host, and until the scheduled events are scheduled for the remaining instances. After these tasks are completed, the replacement host enters the `available` state.

After the replacement host enters the `available` state, you can use it in the same way that you use any host in your account. However, some instance capacity on the replacement host is reserved for the instances that require reboot-based host migration. You can't launch new instances into this reserved capacity.

When the degraded host has no more running instances, it enters the `released, permanent-failure` state, and it is permanently released from your account. Note that the host and its resources remain visible in the console for a short time.

## Automatic migration


Some instances can't be automatically migrated to the replacement host.

**Instances with EBS-backed root volumes**  
For these instances, we schedule instance stop events for 28 days from the date of the notification. At the date and time of the scheduled event, the instances are stopped. We recommend that you manually stop on restart the instance on the replacement host or on a different host. You might need to modify your instance's host affinity to restart it on a different host.

**Instances with an instance store root volume**  
For these instances, we schedule instance retirement events for 28 days from the date of the notification. At the date and time of the scheduled event, the instances are permanently terminated. We recommend that you manually launch replacement instances on the replacement host and then migrate the required data to the replacement instances before the scheduled event.

The following instances have instance store root volumes: C1, C3, D2, I2, M1, M2, M3, R3, and X1.

You can continue to access your instances on the degraded Dedicated Host before the scheduled event.

# Configure the host maintenance setting for an Amazon EC2 Dedicated Host
Configure host maintenance

Enable host maintenance to ensure that your instances running on a Dedicated Host are automatically recovered onto a new Dedicated Host during a scheduled maintenance event.

If you disable host maintenance, you receive an email notification to evict the degraded host and manually migrate your instances to another host within 28 days. A replacement host is allocated if you have Dedicated Host reservation. After 28 days, the instances running on the degraded host are terminated, and the host is released automatically.

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

**To enable host maintenance for your Dedicated Host**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

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

1. Select the Dedicated Host > **Actions** > **Modify host**.

1. Select *on* in the **Host maintenance** field.

**To disable host maintenance for your Dedicated Host**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

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

1. Select the Dedicated Host > **Actions** > **Modify host**.

1. Select *off* in the **Host maintenance** field.

------
#### [ Amazon CLI ]

**To enable host maintenance for your Dedicated Host**  
Use the [modify-hosts](https://docs.amazonaws.cn/cli/latest/reference/ec2/modify-hosts.html) command.

```
aws ec2 modify-hosts \
    --host-maintenance on \
    --host-ids h-0d123456bbf78910d
```

**To disable host maintenance for your Dedicated Host**  
Use the [modify-hosts](https://docs.amazonaws.cn/cli/latest/reference/ec2/modify-hosts.html) command.

```
aws ec2 modify-hosts \
    --host-maintenance off \
    --host-ids h-0d123456bbf78910d
```

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

**To enable host maintenance for your Dedicated Host**  
Use the [Edit-EC2Host](https://docs.amazonaws.cn/powershell/latest/reference/items/Edit-EC2Host.html) cmdlet.

```
Edit-EC2Host `
    -HostMaintenance on `
    -HostId h-0d123456bbf78910d
```

**To disable host maintenance for your Dedicated Host**  
Use the [Edit-EC2Host](https://docs.amazonaws.cn/powershell/latest/reference/items/Edit-EC2Host.html) cmdlet.

```
Edit-EC2Host `
    -HostMaintenance off `
    -HostId h-0d123456bbf78910d
```

------

# Monitor the state of your Amazon EC2 Dedicated Hosts
Monitor Dedicated Hosts

Amazon EC2 constantly monitors the state of your Dedicated Hosts. Updates are communicated on the Amazon EC2 console. You can view information about a Dedicated Host using the following methods.

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

**To view the state of a Dedicated Host**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

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

1. Locate the Dedicated Host in the list and review the value in the **State** column.

------
#### [ Amazon CLI ]

**To view the state of a Dedicated Host**  
Use the [describe-hosts](https://docs.amazonaws.cn/cli/latest/reference/ec2/describe-hosts.html) command.

```
aws ec2 describe-hosts --host-id h-012a3456b7890cdef
```

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

**To view the state of a Dedicated Host**  
Use the [Get-EC2Host](https://docs.amazonaws.cn/powershell/latest/reference/items/Get-EC2Host.html) cmdlet.

```
Get-EC2Host -HostId h-012a3456b7890cdef
```

------

The following table explains the possible Dedicated Host states.


| **State** | **Description** | 
| --- | --- | 
| available | Amazon hasn't detected an issue with the Dedicated Host. No maintenance or repairs are scheduled. Instances can be launched onto this Dedicated Host. | 
| released | The Dedicated Host has been released. The host ID is no longer in use. Released hosts can't be reused. | 
| under-assessment | Amazon is exploring a possible issue with the Dedicated Host. If action must be taken, you are notified via the Amazon Web Services Management Console or email. Instances can't be launched onto a Dedicated Host in this state. | 
| pending | The Dedicated Host can't be used for new instance launches. It is either being [ modified to support multiple instance types](modify-host-support.md), or a [host recovery](dedicated-hosts-recovery.md) is in progress. | 
| permanent-failure | An unrecoverable failure has been detected. You receive an eviction notice through your instances and by email. Your instances might continue to run. If you stop or terminate all instances on a Dedicated Host with this state, Amazon retires the host. Amazon does not restart instances in this state. Instances can't be launched onto Dedicated Hosts in this state. | 
| released-permanent-failure | Amazon permanently releases Dedicated Hosts that have failed and no longer have running instances on them. The Dedicated Host ID is no longer available for use. | 

# Track Amazon EC2 Dedicated Host configuration changes using Amazon Config
Track configuration changes

You can use Amazon Config to record configuration changes for Dedicated Hosts, and for instances that are launched, stopped, or terminated on them. You can then use the information captured by Amazon Config as a data source for license reporting.

Amazon Config records configuration information for Dedicated Hosts and instances individually, and pairs this information through relationships. There are three reporting conditions:
+ **Amazon Config recording status**—When **On**, Amazon Config is recording one or more Amazon resource types, which can include Dedicated Hosts and Dedicated Instances. To capture the information required for license reporting, verify that hosts and instances are being recorded with the following fields.
+ **Host recording status**—When **Enabled**, the configuration information for Dedicated Hosts is recorded.
+ **Instance recording status**—When **Enabled**, the configuration information for Dedicated Instances is recorded.

If any of these three conditions are disabled, the icon in the **Edit Config Recording** button is red. To derive the full benefit of this tool, ensure that all three recording methods are enabled. When all three are enabled, the icon is green. To edit the settings, choose **Edit Config Recording**. You are directed to the **Set up Amazon Config** page in the Amazon Config console, where you can set up Amazon Config and start recording for your hosts, instances, and other supported resource types. For more information, see [Setting up Amazon Config using the Console](https://docs.amazonaws.cn/config/latest/developerguide/resource-config-reference.html) in the *Amazon Config Developer Guide*.

**Note**  
Amazon Config records your resources after it discovers them, which might take several minutes. 

After Amazon Config starts recording configuration changes to your hosts and instances, you can get the configuration history of any host that you have allocated or released and any instance that you have launched, stopped, or terminated. For example, at any point in the configuration history of a Dedicated Host, you can look up how many instances are launched on that host, along with the number of sockets and cores on the host. For any of those instances, you can also look up the ID of its Amazon Machine Image (AMI). You can use this information to report on licensing for your own server-bound software that is licensed per-socket or per-core.

You can view configuration histories in any of the following ways:
+ By using the Amazon Config console. For each recorded resource, you can view a timeline page, which provides a history of configuration details. To view this page, choose the gray icon in the **Config Timeline** column of the **Dedicated Hosts** page. For more information, see [Viewing Configuration Details in the Amazon Config Console](https://docs.amazonaws.cn/config/latest/developerguide/view-manage-resource-console.html) in the *Amazon Config Developer Guide*.
+ By running Amazon CLI commands. First, you can use the [list-discovered-resources](https://docs.amazonaws.cn/cli/latest/reference/configservice/list-discovered-resources.html) command to get a list of all hosts and instances. Then, you can use the [get-resource-config-history](https://docs.amazonaws.cn/cli/latest/reference/configservice/get-resource-config-history.html#get-resource-config-history) command to get the configuration details of a host or instance for a specific time interval.
+ By using the Amazon Config API in your applications. First, you can use the [ListDiscoveredResources](https://docs.amazonaws.cn/config/latest/APIReference/API_ListDiscoveredResources.html) action to get a list of all hosts and instances. Then, you can use the [GetResourceConfigHistory](https://docs.amazonaws.cn/config/latest/APIReference/API_GetResourceConfigHistory.html) action to get the configuration details of a host or instance for a specific time interval.

For example, to get a list of all of your Dedicated Hosts from Amazon Config, run a CLI command such as the following.

```
aws configservice list-discovered-resources --resource-type AWS::EC2::Host
```

To obtain the configuration history of a Dedicated Host from Amazon Config, run a CLI command such as the following.

```
aws configservice get-resource-config-history \
    --resource-type AWS::EC2::Instance \
    --resource-id i-1234567890abcdef0
```

**To manage Amazon Config settings using the console**

1. Open the Amazon EC2 console at [https://console.amazonaws.cn/ec2/](https://console.amazonaws.cn/ec2/).

1. On the **Dedicated Hosts** page, choose **Edit Config Recording**.

1. In the Amazon Config console, follow the steps provided to turn on recording. For more information, see [Setting up Amazon Config using the Console](https://docs.amazonaws.cn/config/latest/developerguide/gs-console.html).

For more information, see [Viewing Configuration Details in the Amazon Config Console](https://docs.amazonaws.cn/config/latest/developerguide/view-manage-resource-console.html).

**To activate Amazon Config using the command line or API**
+ Amazon CLI: [Viewing Configuration Details (Amazon CLI)](https://docs.amazonaws.cn/config/latest/developerguide/view-manage-resource-console.html#view-config-details-cli) in the *Amazon Config Developer Guide*.
+ Amazon EC2 API: [GetResourceConfigHistory](https://docs.amazonaws.cn/config/latest/APIReference/API_GetResourceConfigHistory.html).