

# Track Amazon EC2 Dedicated Host configuration changes using Amazon Config
<a name="dedicated-hosts-aws-config"></a>

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