

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# AWS IoT 使用示例 AWS CLI
<a name="cli_2_iot_code_examples"></a>

以下代码示例向您展示了如何使用with来执行操作和实现常见场景 AWS IoT。 AWS Command Line Interface 

*操作*是大型程序的代码摘录，必须在上下文中运行。您可以通过操作了解如何调用单个服务函数，还可以通过函数相关场景的上下文查看操作。

每个示例都包含一个指向完整源代码的链接，您可以从中找到有关如何在上下文中设置和运行代码的说明。

**Topics**
+ [操作](#actions)

## 操作
<a name="actions"></a>

### `accept-certificate-transfer`
<a name="iot_AcceptCertificateTransfer_cli_2_topic"></a>

以下代码示例演示了如何使用 `accept-certificate-transfer`。

**AWS CLI**  
**接受从其他 AWS 账户转移的设备证书**  
以下`accept-certificate-transfer`示例接受从其他 AWS 账户转移的设备证书。证书通过其 ID 来标识。  

```
aws iot accept-certificate-transfer \
    --certificate-id 488b6a7f2acdeb00a77384e63c4e40b18bEXAMPLEe57b7272ba44c45e3448142
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[将证书转移到另一个账户](https://docs.aws.amazon.com/iot/latest/developerguide/transfer-cert.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[AcceptCertificateTransfer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/accept-certificate-transfer.html)*中的。

### `add-thing-to-billing-group`
<a name="iot_AddThingToBillingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `add-thing-to-billing-group`。

**AWS CLI**  
**示例 1：按名称向账单组添加事物**  
以下 `add-thing-to-billing-group` 示例将名为 `MyLightBulb` 的事物添加到名为 `GroupOne` 的账单组。  

```
aws iot add-thing-to-billing-group \
    --billing-group-name GroupOne \
    --thing-name MyLightBulb
```
此命令不生成任何输出。  
**示例 2：按 ARN 向账单组添加事物**  
以下 `add-thing-to-billing-group` 示例将具有指定 ARN 的事物添加到具有指定 ARN 的账单组。如果您使用多个 AWS 地区或账户，则指定 ARN 会很有帮助。它有助于确保您添加到正确的区域和账户。  

```
aws iot add-thing-to-thing-group \
    --billing-group-arn "arn:aws:iot:us-west-2:123456789012:billinggroup/GroupOne" \
    --thing-arn "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[账单组](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-billing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[AddThingToBillingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/add-thing-to-billing-group.html)*中的。

### `add-thing-to-thing-group`
<a name="iot_AddThingToThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `add-thing-to-thing-group`。

**AWS CLI**  
**向组中添加事物**  
以下 `add-thing-to-thing-group` 示例将指定事物添加到指定事物组。  

```
aws iot add-thing-to-thing-group \
    --thing-name MyLightBulb \
    --thing-group-name LightBulbs
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[AddThingToThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/add-thing-to-thing-group.html)*中的。

### `associate-targets-with-job`
<a name="iot_AssociateTargetsWithJob_cli_2_topic"></a>

以下代码示例演示了如何使用 `associate-targets-with-job`。

**AWS CLI**  
**将事物组与连续作业关联**  
以下 `associate-targets-with-job` 示例将指定事物组与指定连续作业相关联。  

```
aws iot associate-targets-with-job \
    --targets "arn:aws:iot:us-west-2:123456789012:thinggroup/LightBulbs" \
    --job-id "example-job-04"
```
输出：  

```
{
    "jobArn": "arn:aws:iot:us-west-2:123456789012:job/example-job-04",
    "jobId": "example-job-04",
    "description": "example continuous job"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[AssociateTargetsWithJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/associate-targets-with-job.html)*中的。

### `attach-policy`
<a name="iot_AttachPolicy_cli_2_topic"></a>

以下代码示例演示了如何使用 `attach-policy`。

**AWS CLI**  
**示例 1：将策略附加到事物组**  
以下 `attach-policy` 示例将指定策略附加到由其 ARN 标识的事物组。  

```
aws iot attach-policy \
    --target "arn:aws:iot:us-west-2:123456789012:thinggroup/LightBulbs" \
    --policy-name "UpdateDeviceCertPolicy"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
**示例 2：将策略附加到证书**  
以下 `attach-policy` 示例将策略 `UpdateDeviceCertPolicy` 附加到通过证书指定的主体。  

```
aws iot attach-policy \
    --policy-name UpdateDeviceCertPolicy \
    --target "arn:aws:iot:us-west-2:123456789012:cert/4f0ba725787aa94d67d2fca420eca022242532e8b3c58e7465c7778b443fd65e"
```
此命令不生成任何输出。  
有关更多信息，请参阅《[AWS 物联网*开发人员指南》中的 “将AWS 物联网*策略附加到设备证书](https://docs.aws.amazon.com/iot/latest/developerguide/attach-policy-to-certificate.html)”。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[AttachPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/attach-policy.html)*中的。

### `attach-security-profile`
<a name="iot_AttachSecurityProfile_cli_2_topic"></a>

以下代码示例演示了如何使用 `attach-security-profile`。

**AWS CLI**  
**将安全配置文件与所有未注册的设备关联**  
以下`attach-security-profile`示例将名为的 AWS IoT Device Defender 安全配置文件`Testprofile`与该 AWS 账户`us-west-2`在该地区的所有未注册设备相关联。  

```
aws iot attach-security-profile \
    --security-profile-name Testprofile \
    --security-profile-target-arn "arn:aws:iot:us-west-2:123456789012:all/unregistered-things"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[AttachSecurityProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/attach-security-profile.html)*中的。

### `attach-thing-principal`
<a name="iot_AttachThingPrincipal_cli_2_topic"></a>

以下代码示例演示了如何使用 `attach-thing-principal`。

**AWS CLI**  
**将证书附加到事物**  
以下`attach-thing-principal`示例将证书附加到 MyTemperatureSensor 事物。证书通过其 ARN 来标识。您可以在物 AWS 联网控制台中找到证书的 ARN。  

```
aws iot attach-thing-principal \
    --thing-name MyTemperatureSensor \
    --principal arn:aws:iot:us-west-2:123456789012:cert/2e1eb273792174ec2b9bf4e9b37e6c6c692345499506002a35159767055278e8
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[如何使用注册表管理事物](https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[AttachThingPrincipal](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/attach-thing-principal.html)*中的。

### `cancel-audit-mitigation-actions-task`
<a name="iot_CancelAuditMitigationActionsTask_cli_2_topic"></a>

以下代码示例演示了如何使用 `cancel-audit-mitigation-actions-task`。

**AWS CLI**  
**取消审计缓解操作任务**  
以下 `cancel-audit-mitigations-action-task` 示例取消对指定任务应用缓解操作。您无法取消已完成的任务。  

```
aws iot cancel-audit-mitigation-actions-task
    --task-id "myActionsTaskId"
```
此命令不生成任何输出。  
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [CancelAuditMitigationActionsTask （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-CancelAuditMitigationActionsTask)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CancelAuditMitigationActionsTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/cancel-audit-mitigation-actions-task.html)*中的。

### `cancel-audit-task`
<a name="iot_CancelAuditTask_cli_2_topic"></a>

以下代码示例演示了如何使用 `cancel-audit-task`。

**AWS CLI**  
**取消审计任务**  
以下 `cancel-audit-task` 示例取消了具有指定作业 ID 的审计任务。您无法取消已完成的任务。  

```
aws iot cancel-audit-task \
    --task-id a3aea009955e501a31b764abe1bebd3d
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CancelAuditTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/cancel-audit-task.html)*中的。

### `cancel-certificate-transfer`
<a name="iot_CancelCertificateTransfer_cli_2_topic"></a>

以下代码示例演示了如何使用 `cancel-certificate-transfer`。

**AWS CLI**  
**要取消将证书转移到其他 AWS 账户**  
以下 `cancel-certificate-transfer` 示例取消指定证书的转移。证书通过其证书 ID 来标识。您可以在 AWS 物联网控制台中找到证书的 ID。  

```
aws iot cancel-certificate-transfer \
    --certificate-id f0f33678c7c9a046e5cc87b2b1a58dfa0beec26db78addd5e605d630e05c7fc8
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[将证书转移到另一个账户](https://docs.aws.amazon.com/iot/latest/developerguide/transfer-cert.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CancelCertificateTransfer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/cancel-certificate-transfer.html)*中的。

### `cancel-job-execution`
<a name="iot_CancelJobExecution_cli_2_topic"></a>

以下代码示例演示了如何使用 `cancel-job-execution`。

**AWS CLI**  
**取消设备上的作业执行**  
以下 `cancel-job-execution` 示例取消了在设备上执行指定作业。如果作业不是处于 `QUEUED` 状态，则必须添加 `--force` 参数。  

```
aws iot cancel-job-execution \
    --job-id "example-job-03" \
    --thing-name "MyRPi"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CancelJobExecution](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/cancel-job-execution.html)*中的。

### `cancel-job`
<a name="iot_CancelJob_cli_2_topic"></a>

以下代码示例演示了如何使用 `cancel-job`。

**AWS CLI**  
**取消作业**  
以下 `cancel-job` 示例取消指定作业。  

```
aws iot cancel-job \
    --job-job "example-job-03"
```
输出：  

```
{
    "jobArn": "arn:aws:iot:us-west-2:123456789012:job/example-job-03",
    "jobId": "example-job-03",
    "description": "example job test"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CancelJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/cancel-job.html)*中的。

### `clear-default-authorizer`
<a name="iot_ClearDefaultAuthorizer_cli_2_topic"></a>

以下代码示例演示了如何使用 `clear-default-authorizer`。

**AWS CLI**  
**清除默认授权方**  
以下 `clear-default-authorizer` 示例清除当前配置的默认自定义授权方。运行此命令后，将没有默认授权方。当您使用一个自定义授权方时，必须在 HTTP 请求标头中按名称指定它。  

```
aws iot clear-default-authorizer
```
此命令不生成任何输出。  
有关更多信息，请参阅[ClearDefaultAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_ClearDefaultAuthorizer.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ClearDefaultAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/clear-default-authorizer.html)*中的。

### `confirm-topic-rule-destination`
<a name="iot_ConfirmTopicRuleDestination_cli_2_topic"></a>

以下代码示例演示了如何使用 `confirm-topic-rule-destination`。

**AWS CLI**  
**确认主题规则目标**  
以下 `confirm-topic-rule-destination` 示例使用在 HTTP 端点收到的确认令牌来确认主题规则目标。  

```
aws iot confirm-topic-rule-destination \
    --confirmation-token "AYADeIcmtq-ZkxfpiWIQqHWM5ucAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREFxY1E0UmlGeDg0V21BZWZ1VjZtZWFRVUJJUktUYXJaN09OZlJOczJhRENSZmZYL3JHZC9PR3NNcis5T3ZlSitnQT09AAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLWVhc3QtMTo5ODc5NTE4NTI0OTk6a2V5L2U4YmU3ODViLTU5NWMtNDcxYi1iOWJmLWQ2Y2I4ZjQxODlmNwC4AQIBAHhwz48UWTGWE1ua0P8U1hj27nsFzEaAdf6Hs2K_7wBheAF62zwMuk_A4dPiC6eyPGuMAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQM9vtRMpf9D3CiZ8sMAgEQgDuFd0Txy-aywpPqg8YEsa1lD4B40aJ2s1wEHKMybiF1RoOZzYisI0IvslzQY5UmCkqq3tV-3f7-nKfosgIAAAAADAAAEAAAAAAAAAAAAAAAAAAi9RMgy-V19V9m6Iw2xfbw_____wAAAAEAAAAAAAAAAAAAAAEAAAB1hw4SokgUcxiJ3gTO6n50NLJVpzyQR1UmPIj5sShqXEQGcOsWmXzpYOOx_PWyPVNsIFHApyK7Cc3g4bW8VaLVwOLkC83g6YaZAh7dFEl2-iufgrzTePl8RZYOWr0O6Aj9DiVzJZx-1iD6Pu-G6PUw1kaO7Knzs2B4AD0qfrHUF4pYRTvyUgBnMGUCMQC8ZRmhKqntd_c6Kgrow3bMUDBvNqo2qZr8Z8Jm2rzgseROlAnLgFLGpGShr99oSZkCMEd1v62NBRKX9HQXnybyF3fkg__-PIetJ803Z4IlIlF8xXlcdPGP-PV1dOXFemyL8g"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[确认主题规则目标](https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#confirm-destination)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ConfirmTopicRuleDestination](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/confirm-topic-rule-destination.html)*中的。

### `create-audit-suppression`
<a name="iot_CreateAuditSuppression_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-audit-suppression`。

**AWS CLI**  
**创建审计调查发现抑制**  
以下`create-audit-suppression`示例为被标记为过于宽松的名为 “virtualMachinePolicy” 的策略创建了审计结果抑制功能。  

```
aws iot create-audit-suppression \
    --check-name IOT_POLICY_OVERLY_PERMISSIVE_CHECK \
    --resource-identifier policyVersionIdentifier={"policyName"="virtualMachinePolicy","policyVersionId"="1"} \
    --no-suppress-indefinitely \
    --expiration-date 2020-10-20
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[审计调查发现抑制](https://docs.aws.amazon.com/iot/latest/developerguide/audit-finding-suppressions.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateAuditSuppression](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-audit-suppression.html)*中的。

### `create-authorizer`
<a name="iot_CreateAuthorizer_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-authorizer`。

**AWS CLI**  
**创建自定义授权方**  
以下 `create-authorizer` 示例创建了一个自定义授权方，该授权方使用指定的 Lambda 函数作为自定义身份验证服务的一部分。  

```
   aws iot create-authorizer \
       --authorizer-name "CustomAuthorizer" \
       --authorizer-function-arn "arn:aws:lambda:us-west-2:123456789012:function:CustomAuthorizerFunction" \
       --token-key-name "MyAuthToken" \
       --status ACTIVE \
       --token-signing-public-keys FIRST_KEY="-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1uJOB4lQPgG/lM6ZfIwo
Z+7ENxAio9q6QD4FFqjGZsvjtYwjoe1RKK0U8Eq9xb5O3kRSmyIwTzwzm/f4Gf0Y
ZUloJ+t3PUUwHrmbYTAgTrCUgRFygjfgVwGCPs5ZAX4Eyqt5cr+AIHIiUDbxSa7p
zwOBKPeic0asNJpqT8PkBbRaKyleJh5oo81NDHHmVtbBm5A5YiJjqYXLaVAowKzZ
+GqsNvAQ9Jy1wI2VrEa1OfL8flDB/BJLm7zjpfPOHDJQgID0XnZwAlNnZcOhCwIx
50g2LW2Oy9R/dmqtDmJiVP97Z4GykxPvwlYHrUXY0iW1R3AR/Ac1NhCTGZMwVDB1
lQIDAQAB
-----END PUBLIC KEY-----"
```
输出：  

```
{
    "authorizerName": "CustomAuthorizer",
    "authorizerArn": "arn:aws:iot:us-west-2:123456789012:authorizer/CustomAuthorizer2"
}
```
有关更多信息，请参阅[CreateAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateAuthorizer.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-authorizer.html)*中的。

### `create-billing-group`
<a name="iot_CreateBillingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-billing-group`。

**AWS CLI**  
**创建账单组**  
以下 `create-billing-group` 示例创建一个名为 `GroupOne` 的简单账单组。  

```
aws iot create-billing-group \
    --billing-group-name GroupOne
```
输出：  

```
{
    "billingGroupName": "GroupOne",
    "billingGroupArn": "arn:aws:iot:us-west-2:123456789012:billinggroup/GroupOne",
    "billingGroupId": "103de383-114b-4f51-8266-18f209ef5562"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[账单组](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-billing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateBillingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-billing-group.html)*中的。

### `create-certificate-from-csr`
<a name="iot_CreateCertificateFromCsr_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-certificate-from-csr`。

**AWS CLI**  
**根据证书签名请求（CSR）创建设备证书**  
以下 `create-certificate-from-csr` 示例根据 CSR 创建设备证书。您可以使用 `openssl` 命令创建 CSR。  

```
aws iot create-certificate-from-csr \
    --certificate-signing-request=file://certificate.csr
```
输出：  

```
{
    "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/c0c57bbc8baaf4631a9a0345c957657f5e710473e3ddbee1428d216d54d53ac9",
        "certificateId": "c0c57bbc8baaf4631a9a0345c957657f5e710473e3ddbee1428d216d54d53ac9",
        "certificatePem": "<certificate-text>"
}
```
有关更多信息，请参阅《*AWS 物联网 API 参考*》中的 [CreateCertificateFromCSR](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateCertificateFromCsr.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateCertificateFromCsr](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-certificate-from-csr.html)*中的。

### `create-custom-metric`
<a name="iot_CreateCustomMetric_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-custom-metric`。

**AWS CLI**  
**创建由您的设备发布到 Device Defender 的自定义指标**  
以下 `create-custom-metric` 示例创建用于测量电池百分比的自定义指标。  

```
aws iot create-custom-metric \
    --metric-name "batteryPercentage" \
    --metric-type "number" \
    --display-name "Remaining battery percentage." \
    --region us-east-1 \
    --client-request-token "02ccb92b-33e8-4dfa-a0c1-35b181ed26b0"
```
输出：  

```
{
    "metricName": "batteryPercentage",
    "metricArn": "arn:aws:iot:us-east-1:1234564789012:custommetric/batteryPercentage"
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[自定义指标](https://docs.aws.amazon.com/iot/latest/developerguide/dd-detect-custom-metrics.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateCustomMetric](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-custom-metric.html)*中的。

### `create-dimension`
<a name="iot_CreateDimension_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-dimension`。

**AWS CLI**  
**创建维度**  
以下 `create-dimension` 使用称为 `TopicFilterForAuthMessages` 的单个主题筛选器创建一个维度。  

```
aws iot create-dimension \
    --name TopicFilterForAuthMessages \
    --type TOPIC_FILTER \
    --string-values device/+/auth
```
输出：  

```
{
    "name": "TopicFilterForAuthMessages",
    "arn": "arn:aws:iot:eu-west-2:123456789012:dimension/TopicFilterForAuthMessages"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateDimension](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-dimension.html)*中的。

### `create-domain-configuration`
<a name="iot_CreateDomainConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-domain-configuration`。

**AWS CLI**  
**创建域配置**  
以下`create-domain-configuration`示例创建服务类型为的 AWS托管域配置。`DATA`  

```
aws iot create-domain-configuration \
    --domain-configuration-name "additionalDataDomain" \
    --service-type "DATA"
```
输出：  

```
{
    "domainConfigurationName": "additionalDataDomain",
    "domainConfigurationArn": "arn:aws:iot:us-west-2:123456789012:domainconfiguration/additionalDataDomain/dikMh"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[可配置的端点](https://docs.aws.amazon.com/iot/latest/developerguide/iot-custom-endpoints-configurable-aws.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateDomainConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-domain-configuration.html)*中的。

### `create-dynamic-thing-group`
<a name="iot_CreateDynamicThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-dynamic-thing-group`。

**AWS CLI**  
**创建动态事物组**  
以下 `create-dynamic-thing-group` 示例创建了一个动态事物组，其中包含温度属性大于 60 度的任何事物。必须先启用 AWS IoT 队列索引，然后才能使用动态事物组。  

```
aws iot create-dynamic-thing-group \
    --thing-group-name "RoomTooWarm" \
    --query-string "attributes.temperature>60"
```
输出：  

```
{
    "thingGroupName": "RoomTooWarm",
    "thingGroupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/RoomTooWarm",
    "thingGroupId": "9d52492a-fc87-43f4-b6e2-e571d2ffcad1",
    "indexName": "AWS_Things",
    "queryString": "attributes.temperature>60",
    "queryVersion": "2017-09-30"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[动态事物组](https://docs.aws.amazon.com/iot/latest/developerguide/dynamic-thing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateDynamicThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-dynamic-thing-group.html)*中的。

### `create-job`
<a name="iot_CreateJob_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-job`。

**AWS CLI**  
**示例 1：创建作业**  
以下`create-job`示例创建了一个向`MyRaspberryPi`设备发送 JSON 文档的简单 AWS 物联网作业。  

```
aws iot create-job \
    --job-id "example-job-01" \
    --targets "arn:aws:iot:us-west-2:123456789012:thing/MyRaspberryPi" \
    --document file://example-job.json \
    --description "example job test" \
    --target-selection SNAPSHOT
```
输出：  

```
{
    "jobArn": "arn:aws:iot:us-west-2:123456789012:job/example-job-01",
    "jobId": "example-job-01",
    "description": "example job test"
}
```
**示例 2：创建连续作业**  
以下 `create-job` 示例创建了一个可在指定为目标的事物完成作业后继续运行的作业。在此示例中，目标是一个事物组，因此，当新设备被添加到该组时，连续作业将在这些新事物上运行。  
aws iot create-job —job-id “example-job-04” —目标 “arn: aws: iot: us-west-2:123456789012：-job.json —描述 “示例连续作业” —目标选择连续 thinggroup/DeadBulbs" --document file://example  
输出：  

```
{
    "jobArn": "arn:aws:iot:us-west-2:123456789012:job/example-job-04",
    "jobId": "example-job-04",
    "description": "example continuous job"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-job.html)*中的。

### `create-keys-and-certificate`
<a name="iot_CreateKeysAndCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-keys-and-certificate`。

**AWS CLI**  
**创建 RSA 密钥对并发放 X.509 证书**  
以下 `create-keys-and-certificate` 命令创建一个 2048 位 RSA 密钥对，并使用发出的公钥发放 X.509 证书。由于这是 AWS 物联网唯一一次为此证书提供私钥，因此请务必将其保存在安全的地方。  

```
aws iot create-keys-and-certificate \
    --certificate-pem-outfile "myTest.cert.pem" \
    --public-key-outfile "myTest.public.key" \
    --private-key-outfile "myTest.private.key"
```
输出：  

```
{
    "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/9894ba17925e663f1d29c23af4582b8e3b7619c31f3fbd93adcb51ae54b83dc2",
    "certificateId": "9894ba17925e663f1d29c23af4582b8e3b7619c31f3fbd93adcb51ae54b83dc2",
    "certificatePem": "
-----BEGIN CERTIFICATE-----
MIICiTCCEXAMPLE6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMC
VVMxCzAJBgNVBAgEXAMPLEAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6
b24xFDASBgNVBAsTC0lBTSEXAMPLE2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAd
BgkqhkiG9w0BCQEWEG5vb25lQGFtYEXAMPLEb20wHhcNMTEwNDI1MjA0NTIxWhcN
MTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCEXAMPLEJBgNVBAgTAldBMRAwDgYD
VQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDAEXAMPLEsTC0lBTSBDb25z
b2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEXAMPLE25lQGFt
YXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+aEXAMPLE
EXAMPLEfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9T
rDHudUZEXAMPLELG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpE
Ibb3OhjZnzcvQAEXAMPLEWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4
nUhVVxYUntneD9+h8Mg9qEXAMPLEyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0Fkb
FFBjvSfpJIlJ00zbhNYS5f6GuoEDEXAMPLEBHjJnyp378OD8uTs7fLvjx79LjSTb
NYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=
-----END CERTIFICATE-----\n",
    "keyPair": {
        "PublicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkEXAMPLEQEFAAOCAQ8AMIIBCgKCAQEAEXAMPLE1nnyJwKSMHw4h\nMMEXAMPLEuuN/dMAS3fyce8DW/4+EXAMPLEyjmoF/YVF/gHr99VEEXAMPLE5VF13\n59VK7cEXAMPLE67GK+y+jikqXOgHh/xJTwo+sGpWEXAMPLEDz18xOd2ka4tCzuWEXAMPLEahJbYkCPUBSU8opVkR7qkEXAMPLE1DR6sx2HocliOOLtu6Fkw91swQWEXAMPLE\GB3ZPrNh0PzQYvjUStZeccyNCx2EXAMPLEvp9mQOUXP6plfgxwKRX2fEXAMPLEDa\nhJLXkX3rHU2xbxJSq7D+XEXAMPLEcw+LyFhI5mgFRl88eGdsAEXAMPLElnI9EesG\nFQIDAQAB\n-----END PUBLIC KEY-----\n",
        "PrivateKey": "-----BEGIN RSA PRIVATE KEY-----\nkey omittted for security reasons\n-----END RSA PRIVATE KEY-----\n"
    }
}
```
有关更多信息，请参阅《[AWS 物联网**开发者指南》中的创建和注册AWS 物联网**设备证书](https://docs.aws.amazon.com/iot/latest/developerguide/device-certs-create.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateKeysAndCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-keys-and-certificate.html)*中的。

### `create-mitigation-action`
<a name="iot_CreateMitigationAction_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-mitigation-action`。

**AWS CLI**  
**创建缓解操作**  
以下 `create-mitigation-action` 示例定义了一个名为 `AddThingsToQuarantineGroup1Action` 的缓解操作，当应用该操作时，事物将被移入名为 `QuarantineGroup1` 的事物组中。此操作将覆盖动态事物组。  

```
aws iot create-mitigation-action --cli-input-json file::params.json
```
`params.json` 的内容：  

```
{
    "actionName": "AddThingsToQuarantineGroup1Action",
    "actionParams": {
        "addThingsToThingGroupParams": {
            "thingGroupNames": [
                "QuarantineGroup1"
            ],
            "overrideDynamicGroups": true
        }
    },
    "roleArn": "arn:aws:iam::123456789012:role/service-role/MoveThingsToQuarantineGroupRole"
}
```
输出：  

```
{
    "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/AddThingsToQuarantineGroup1Action",
    "actionId": "992e9a63-a899-439a-aa50-4e20c52367e1"
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [CreateMitigationAction （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/iot/latest/developerguide/iot/latest/developerguide/mitigation-action-commands.html.html#dd-api-iot-CreateMitigationAction)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateMitigationAction](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-mitigation-action.html)*中的。

### `create-ota-update`
<a name="iot_CreateOtaUpdate_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-ota-update`。

**AWS CLI**  
**创建用于 Amazon FreeRTOS 的 OTA 更新**  
以下`create-ota-update`示例在目标事 AWS 物组或组 OTAUpdate 上创建物联网。这是 Amazon F over-the-air reeRTOS 更新的一部分，它使您可以将新的固件映像部署到单个设备或一组设备上。  

```
aws iot create-ota-update \
    --cli-input-json file://create-ota-update.json
```
`create-ota-update.json` 的内容：  

```
{
    "otaUpdateId": "ota12345",
    "description": "A critical update needed right away.",
    "targets": [
        "device1",
        "device2",
        "device3",
        "device4"
    ],
    "targetSelection": "SNAPSHOT",
    "awsJobExecutionsRolloutConfig": {
        "maximumPerMinute": 10
    },
    "files": [
        {
          "fileName": "firmware.bin",
          "fileLocation": {
            "stream": {
              "streamId": "004",
              "fileId":123
            }
          },
          "codeSigning": {
            "awsSignerJobId": "48c67f3c-63bb-4f92-a98a-4ee0fbc2bef6"
          }
        }
    ]
    "roleArn": "arn:aws:iam:123456789012:role/service-role/my_ota_role"
}
```
输出：  

```
{
     "otaUpdateId": "ota12345",
     "awsIotJobId": "job54321",
     "otaUpdateArn": "arn:aws:iot:us-west-2:123456789012:otaupdate/itsaupdate",
     "awsIotJobArn": "arn:aws:iot:us-west-2:123456789012:job/itsajob",
     "otaUpdateStatus": "CREATE_IN_PROGRESS"
}
```
有关更多信息，请参阅《*AWS IoT API 参考*》OTAUpdate中的 “[创建](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateOTAUpdate.html)”。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateOtaUpdate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-ota-update.html)*中的。

### `create-policy-version`
<a name="iot_CreatePolicyVersion_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-policy-version`。

**AWS CLI**  
**使用新版本更新策略**  
以下 `create-policy-version` 示例更新了策略定义，创建了新的策略版本。此示例还将新版本设为默认版本。  

```
aws iot create-policy-version \
    --policy-name UpdateDeviceCertPolicy \
    --policy-document file://policy.json \
    --set-as-default
```
`policy.json` 的内容：  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action":  "iot:UpdateCertificate",
            "Resource": "*"
        }
    ]
}
```
输出：  

```
{
    "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/UpdateDeviceCertPolicy",
    "policyDocument": "{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Effect\": \"Allow\", \"Action\":  \"iot:UpdateCertificate\", \"Resource\": \"*\" } ] }",
    "policyVersionId": "2",
    "isDefaultVersion": true
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的 [AWS IoT 策略](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreatePolicyVersion](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-policy-version.html)*中的。

### `create-policy`
<a name="iot_CreatePolicy_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-policy`。

**AWS CLI**  
**创建 AWS 物联网策略**  
以下`create-policy`示例创建了一个名为的 AWS IoT 策略 TemperatureSensorPolicy。该`policy.json`文件包含允许 AWS IoT 策略操作的语句。  

```
aws iot create-policy \
    --policy-name TemperatureSensorPolicy \
    --policy-document file://policy.json
```
`policy.json` 的内容：  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:Publish",
                "iot:Receive"
            ],
            "Resource": [
                "arn:aws:iot:us-west-2:123456789012:topic/topic_1",
                "arn:aws:iot:us-west-2:123456789012:topic/topic_2"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "iot:Subscribe"
            ],
            "Resource": [
                "arn:aws:iot:us-west-2:123456789012:topicfilter/topic_1",
                "arn:aws:iot:us-west-2:123456789012:topicfilter/topic_2"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "iot:Connect"
            ],
            "Resource": [
                "arn:aws:iot:us-west-2:123456789012:client/basicPubSub"
            ]
        }
    ]
}
```
输出：  

```
{
    "policyName": "TemperatureSensorPolicy",
    "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/TemperatureSensorPolicy",
    "policyDocument": "{
        \"Version\": \"2012-10-17\",
        \"Statement\": [
            {
                \"Effect\": \"Allow\",
                \"Action\": [
                    \"iot:Publish\",
                    \"iot:Receive\"
                ],
                \"Resource\": [
                    \"arn:aws:iot:us-west-2:123456789012:topic/topic_1\",
                    \"arn:aws:iot:us-west-2:123456789012:topic/topic_2\"
                ]
            },
            {
                \"Effect\": \"Allow\",
                \"Action\": [
                    \"iot:Subscribe\"
                ],
                \"Resource\": [
                    \"arn:aws:iot:us-west-2:123456789012:topicfilter/topic_1\",
                    \"arn:aws:iot:us-west-2:123456789012:topicfilter/topic_2\"
                ]
            },
            {
                \"Effect\": \"Allow\",
                \"Action\": [
                    \"iot:Connect\"
                ],
                \"Resource\": [
                    \"arn:aws:iot:us-west-2:123456789012:client/basicPubSub\"
                ]
            }
        ]
    }",
    "policyVersionId": "1"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的 [AWS IoT 策略](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreatePolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-policy.html)*中的。

### `create-provisioning-claim`
<a name="iot_CreateProvisioningClaim_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-provisioning-claim`。

**AWS CLI**  
**创建预配声明**  
以下 `create-provisioning-claim` 示例根据预配模板创建预配声明。  

```
aws iot create-provisioning-claim \
    --template-name MyTestProvisioningTemplate
```
输出：  

```
{
    "certificateId": "78de02184b2ce80cf8fb709bda59e62b19fb83513590483eb0434589476ab09f",
    "certificatePem": "-----BEGIN CERTIFICATE-----\nMIIDdzCCAl+gAwIBAgIUXSZhEBLztMLZ2fHG
14gV0NymYY0wDQYJKoZIhvcNAQEL\nBQAwfjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBg
VBAcM\nB1NlYXR0bGUxGDAWBgNVBAoMD0FtYXpvbi5jb20gSW5jLjEgMB4GA1UECwwXQW1h\nem9uIElvVCBQcm9
2aXNpb25pbmcxDDAKBgNVBAUTAzEuMDAeFw0yMDA3MjgxNjQ0\nMDZaFw0yMDA3MjgxNjUxMDZaMEsxSTBHBgNVB
AMMQDFhNDEyM2VkNmIxYjU3MzE3\nZTgzMTJmY2MzN2FiNTdhY2MzYTZkZGVjOGQ5OGY3NzUwMWRlMjc0YjhmYTQ
xN2Iw\nggEiMA0GCSqGSIb3EXAMPLEAA4IBDwAwggEKAoIBAQDBhKI94ktKLqTwnj+ayOq1\nTAJt/N6s6IJDZvl
rYjkC0E7wzaeY3TprWk03S29vUzVuEOXHXQXZbihgpg2m6fza\nkWm9/wpjzE9ny5+xkPGVH4Wnwz7yK5m8S0agL
T96cRBSWnWmonOWdY0GKVzni0CA\n+iyGudgrFKm7Eae/v18oXrf82KtOAGO4xG0KE2WKYHsT1fx3c9xZhlXP/eX
Lhv00\n+lGp0WVw9PbhKfrxliKJ5q6sL5nVUaUHq6hlQPYwsATeOvAp3u0ak5zgTyL0fg7Y\nPyKk6VYwLW62r+V
YBSForEMOAhkq3LsP/rjxpEKmi2W4lPVS6oFZRKcD+H1Kyil5\nAgMBAAGjIDAeMAwGA1UdEwEB/wQCMAAwDgYDV
R0PAQH/BAQDAgeAMA0GCSqGSIb3\nDQEBCwUAA4IBAQAGgix2k6nVqbZFKq97/fZBzLGS0dyz5rT/E41cDIRX+1j
EPW41\nw0D+2sXheCZLZZnSkvIiP74IToNeXDrjdcaodeGFVHIElRjhMIq+4ZebPbRLtidF\nRc2hfcTAlqq9Z6v
5Vk6BeM1tu0RqH1wPoVUccLPya8EjNCbnJZUmGdOfrN/Y9pho\n5ikV+HPeZhG/k6dhE2GsQJyKFVHL/uBgKSily
1bRyWU1r6qcpWBNBHjUoD7HgOwD\nnzMh4XRb2FQDsqFalkCSYmeL8IVC49sgPD9Otyp5uteGMTy62usAAUQdq/f
ZvrWg\nOkFpwMVnGKVKT7Kg0kKOLzKWOBB2Jm4/gmrJ\n-----END CERTIFICATE-----\n",
    "keyPair": {
        "PublicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCg
KCAQEAwYSiPeJLSi6k8J4/msjq\ntUwCbfzerOiCQ2b5a2I5AtBO8M2nmN06a1pNN0tvb1M1bhDlx10F2W4oYKYN
pun8\n2pFpvf8KY8xPZ8ufsZDxlR+Fp8M+8iuZvEtGoC0/enEQUlp1pqJzlnWNBilc54tA\ngPoshrnYKxSpuxGn
v79fKF63/NirTgBjuMRtChNlimEXAMPLE3PcWYZVz/3ly4b9\nNPpRqdFlcPT24Sn68ZYiieaurC+Z1VGlB6uoZU
D2MLAE3jrwKd7tGpOc4E8i9H4O\n2D8ipOlWMC1utq/lWAUhaKxDDgIZKty7D/648aRCpotluJT1UuqBWUSnA/h9
Ssop\neQIDAQAB\n-----END PUBLIC KEY-----\n",
        "PrivateKey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwYSiPeJLSi6k8J4/
msjqtUwCbfzerOiCQ2b5a2I5AtBO8M2n\nmN06a1pNN0tvb1M1bhDlx10F2W4oYKYNpun82pFpvf8KY8xPZ8ufsZ
DxlR+Fp8M+\n8iuZvEtGoC0/enEQUlp1pqJzlnWNBilc54tAgPoshrnYKxSpuxGnv79fKF63/Nir\nTgBjuMRtCh
NlimB7E9X8d3PcWYZVz/3ly4b9NPpRqdFlcPT24Sn68ZYiieaurC+Z\n1VGlB6uoZUD2MLAE3jrwKd7tGpOc4E8i
9H4O2D8ipOlWMC1utq/lWAUhaKxDDgIZ\nKty7D/648aRCpotluJT1UuqBWUSnA/h9SsopeQIDAQABAoIBAEAybN
QUtx9T2/nK\ntZT2pA4iugecxI4dz+DmT0XVXs5VJmrx/nBSq6ejXExEpSIMO4RY7LE3ZdJcnd56\nF7tQkkY7yR
VzfxHeXFU1krOIPuxWebNOrRoPZr+1RSer+wv2aBC525+88pVuR6tM\nm3pgkrR2ycCj9FdOUoQxdjHBHaM5PDmJ
9aSxCKdg3nReepeGwsR2TQA+m2vVxWk7\nou0+91eTOP+/QfP7P8ZjOIkO2XivlRcVDyN/E4QXPKuIkM/8vS8VK+
E9pATQ0MtB\n2lw8R/YU5AJd6jlEXAMPLEGU2UzRzInNWiLtkPPPqgqXXhxOf+mxByjcMalVJk0L\nhOG2ROUCgY
EA+ROcHNHy/XbsP7FihOhEh+6Q2QxQ2ncBUPYbBazrR8Hn+7SCICQK\nVyYfd8Ajfq3e7RsKVL5SlMBp7Slidxak
bIn28fKfPn62DaemGCIoyDgLpF+eUxBx\ngzbCiBZga8brfurza43UZjKZLpg3hq721+FeAiXi1Nma4Yr9YWEHEN
8CgYEAxuWt\npzdWWmsiFzfsAw0sy9ySDA/xr5WRWzJyAqUsjsks6rxNzWebpufnYHcmtW7pLdqM\nkboHwN2pXa
kmZvrk2nKkEMq5brBYGDXuxDe+V369Bianx8aZFyIsckA7OwXW1w1h\ngRC5rQ4XOgp3+Jmw7eAO8LRYDjaN846+
QbtO2KcCgYAWS0UL51bijQR0ZwI0dz27\nFQVuCAYsp748aurcRTACCj8jbnK/QbqTNlxWsaH7ssBjZKo2D5sAqY
BRtASWODab\naHXsDhVm2Jye+ESLoHMaCLoyCkT3ll8yqXIcEDStMO7fO1Ryag164EiJvSIrMfny\nNL/fXVjCSH
/udCxdzPt+7QKBgQC+LAD7rxdr4J9538hTqpc4XK9vxRbrMXEH55XH\nHbMa2xONZXpmeTgEQBukyohCVceyRhK9
i0e6irZTjVXghOeoTpC8VXkzcnzouTiQ\neFQQSGfnp7Ioe6UIz23715pKduzSNkMSKrG924ktv7CyDBF1gBQI5g
aDoHnddJBJ\nPRTIZQKBgA8MASXtTxQntRwXXzR92U0vAighiuRkB/mx9jQpUcK1qiqHbkAMqgNF\nPFCBYIUbFT
iYKKKeJNbyJQvjfsJCkAnaFJ+RnTxk0Q6Wjm20peJ/ii4QiDdnigoE\nvdlc5cFQewWb4/zqAtPdinkPlN94ileI
79XQdc7RlJ0jpgTimL+V\n-----END RSA PRIVATE KEY-----\n"
    },
    "expiration": 1595955066.0
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[通过可信用户预配](https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#trusted-user)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateProvisioningClaim](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-provisioning-claim.html)*中的。

### `create-provisioning-template-version`
<a name="iot_CreateProvisioningTemplateVersion_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-provisioning-template-version`。

**AWS CLI**  
**创建预配模板版本**  
以下示例为指定预配模板创建了一个版本。文件 `template.json` 中提供了新版本的正文。  

```
aws iot create-provisioning-template-version \
    --template-name widget-template \
    --template-body file://template.json
```
`template.json` 的内容：  

```
{
    "Parameters" : {
        "DeviceLocation": {
            "Type": "String"
        }
    },
    "Mappings": {
        "LocationTable": {
            "Seattle": {
                "LocationUrl": "https://example.aws"
            }
        }
    },
    "Resources" : {
        "thing" : {
            "Type" : "AWS::IoT::Thing",
            "Properties" : {
                "AttributePayload" : {
                    "version" : "v1",
                    "serialNumber" : "serialNumber"
                },
                "ThingName" : {"Fn::Join":["",["ThingPrefix_",{"Ref":"SerialNumber"}]]},
                "ThingTypeName" : {"Fn::Join":["",["ThingTypePrefix_",{"Ref":"SerialNumber"}]]},
                "ThingGroups" : ["widgets", "WA"],
                "BillingGroup": "BillingGroup"
            },
            "OverrideSettings" : {
                "AttributePayload" : "MERGE",
                "ThingTypeName" : "REPLACE",
                "ThingGroups" : "DO_NOTHING"
            }
        },
        "certificate" : {
            "Type" : "AWS::IoT::Certificate",
            "Properties" : {
                "CertificateId": {"Ref": "AWS::IoT::Certificate::Id"},
                "Status" : "Active"
            }
        },
        "policy" : {
            "Type" : "AWS::IoT::Policy",
            "Properties" : {
                "PolicyDocument" : {
                    "Version":"2012-10-17",		 	 	 
                    "Statement": [{
                        "Effect": "Allow",
                        "Action":["iot:Publish"],
                        "Resource": ["arn:aws:iot:us-east-1:123456789012:topic/foo/bar"]
                    }]
                }
            }
        }
    },
    "DeviceConfiguration": {
        "FallbackUrl": "https://www.example.com/test-site",
        "LocationUrl": {
            "Fn::FindInMap": ["LocationTable",{"Ref": "DeviceLocation"}, "LocationUrl"]}
        }
    }
}
```
输出：  

```
{
    "templateArn": "arn:aws:iot:us-east-1:123456789012:provisioningtemplate/widget-template",
    "templateName": "widget-template",
    "versionId": 2,
    "isDefaultVersion": false
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》中的 [AWS IoT 安全隧道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateProvisioningTemplateVersion](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-provisioning-template-version.html)*中的。

### `create-provisioning-template`
<a name="iot_CreateProvisioningTemplate_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-provisioning-template`。

**AWS CLI**  
**创建预配模板**  
以下 `create-provisioning-template` 示例按照文件 `template.json` 的定义创建预配模板。  

```
aws iot create-provisioning-template \
    --template-name widget-template \
    --description "A provisioning template for widgets" \
    --provisioning-role-arn arn:aws:iam::123456789012:role/Provision_role \
    --template-body file://template.json
```
`template.json` 的内容：  

```
{
    "Parameters" : {
        "DeviceLocation": {
            "Type": "String"
        }
    },
    "Mappings": {
        "LocationTable": {
            "Seattle": {
                "LocationUrl": "https://example.aws"
            }
        }
    },
    "Resources" : {
        "thing" : {
            "Type" : "AWS::IoT::Thing",
            "Properties" : {
                "AttributePayload" : {
                    "version" : "v1",
                    "serialNumber" : "serialNumber"
                },
                "ThingName" : {"Fn::Join":["",["ThingPrefix_",{"Ref":"SerialNumber"}]]},
                "ThingTypeName" : {"Fn::Join":["",["ThingTypePrefix_",{"Ref":"SerialNumber"}]]},
                "ThingGroups" : ["widgets", "WA"],
                "BillingGroup": "BillingGroup"
            },
            "OverrideSettings" : {
                "AttributePayload" : "MERGE",
                "ThingTypeName" : "REPLACE",
                "ThingGroups" : "DO_NOTHING"
            }
        },
        "certificate" : {
            "Type" : "AWS::IoT::Certificate",
            "Properties" : {
                "CertificateId": {"Ref": "AWS::IoT::Certificate::Id"},
                "Status" : "Active"
            }
        },
        "policy" : {
            "Type" : "AWS::IoT::Policy",
            "Properties" : {
                "PolicyDocument" : {
                    "Version":"2012-10-17",		 	 	 
                    "Statement": [{
                        "Effect": "Allow",
                        "Action":["iot:Publish"],
                        "Resource": ["arn:aws:iot:us-east-1:504350838278:topic/foo/bar"]
                    }]
                }
            }
        }
    },
    "DeviceConfiguration": {
        "FallbackUrl": "https://www.example.com/test-site",
        "LocationUrl": {
            "Fn::FindInMap": ["LocationTable",{"Ref": "DeviceLocation"}, "LocationUrl"]}
        }
    }
}
```
输出：  

```
{
    "templateArn": "arn:aws:iot:us-east-1:123456789012:provisioningtemplate/widget-template",
    "templateName": "widget-template",
    "defaultVersionId": 1
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》中的 [AWS IoT 安全隧道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateProvisioningTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-provisioning-template.html)*中的。

### `create-role-alias`
<a name="iot_CreateRoleAlias_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-role-alias`。

**AWS CLI**  
**创建角色别名**  
以下 `create-role-alias` 示例为指定角色创建名为 `LightBulbRole` 的角色别名。  

```
aws iot create-role-alias \
    --role-alias LightBulbRole \
    --role-arn arn:aws:iam::123456789012:role/lightbulbrole-001
```
输出：  

```
{
    "roleAlias": "LightBulbRole",
    "roleAliasArn": "arn:aws:iot:us-west-2:123456789012:rolealias/LightBulbRole"
}
```
有关更多信息，请参阅[CreateRoleAlias](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateRoleAlias.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateRoleAlias](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-role-alias.html)*中的。

### `create-scheduled-audit`
<a name="iot_CreateScheduledAudit_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-scheduled-audit`。

**AWS CLI**  
**创建预定审计**  
以下 `create-scheduled-audit` 示例创建了一个预定审计，该审计每周星期三运行，以检查 CA 证书或设备证书是否即将过期。  

```
aws iot create-scheduled-audit \
    --scheduled-audit-name WednesdayCertCheck \
    --frequency WEEKLY \
    --day-of-week WED \
    --target-check-names CA_CERTIFICATE_EXPIRING_CHECK DEVICE_CERTIFICATE_EXPIRING_CHECK
```
输出：  

```
{
    "scheduledAuditArn": "arn:aws:iot:us-west-2:123456789012:scheduledaudit/WednesdayCertCheck"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateScheduledAudit](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-scheduled-audit.html)*中的。

### `create-security-profile`
<a name="iot_CreateSecurityProfile_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-security-profile`。

**AWS CLI**  
**创建安全配置文件**  
以下 `create-security-profile` 示例创建了一个安全配置文件，用于检查蜂窝带宽是否超过阈值，或者在五分钟内是否出现超过 10 次授权失败。  

```
aws iot create-security-profile \
    --security-profile-name PossibleIssue \
    --security-profile-description "Check to see if authorization fails 10 times in 5 minutes or if cellular bandwidth exceeds 128"  \
    --behaviors "[{\"name\":\"CellularBandwidth\",\"metric\":\"aws:message-byte-size\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":128},\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}},{\"name\":\"Authorization\",\"metric\":\"aws:num-authorization-failures\",\"criteria\":{\"comparisonOperator\":\"less-than\",\"value\":{\"count\":10},\"durationSeconds\":300,\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}}]"
```
输出：  

```
{
    "securityProfileName": "PossibleIssue",
    "securityProfileArn": "arn:aws:iot:us-west-2:123456789012:securityprofile/PossibleIssue"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateSecurityProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-security-profile.html)*中的。

### `create-stream`
<a name="iot_CreateStream_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-stream`。

**AWS CLI**  
**创建一个流以便通过 MQTT 以块的形式传送一个或多个大文件**  
以下 `create-stream` 示例创建一个流，以便通过 MQTT 以块的形式传送一个或多个大文件。流将来自 S3 之类的源的数据字节打包为 MQTT 消息，以块或数据块的形式传输。您可以将一个或多个文件与一个流关联。  

```
aws iot create-stream \
    --cli-input-json file://create-stream.json
```
`create-stream.json` 的内容：  

```
{
    "streamId": "stream12345",
    "description": "This stream is used for Amazon FreeRTOS OTA Update 12345.",
    "files": [
        {
            "fileId": 123,
            "s3Location": {
                "bucket":"codesign-ota-bucket",
                "key":"48c67f3c-63bb-4f92-a98a-4ee0fbc2bef6"
            }
        }
    ],
    "roleArn": "arn:aws:iam:123456789012:role/service-role/my_ota_stream_role"
}
```
输出：  

```
{
     "streamId": "stream12345",
     "streamArn": "arn:aws:iot:us-west-2:123456789012:stream/stream12345",
     "description": "This stream is used for Amazon FreeRTOS OTA Update 12345.",
     "streamVersion": "1"
}
```
有关更多信息，请参阅[CreateStream](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateStream.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateStream](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-stream.html)*中的。

### `create-thing-group`
<a name="iot_CreateThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-thing-group`。

**AWS CLI**  
**示例 1：创建事物组**  
以下 `create-thing-group` 示例使用一个描述和两个属性创建了一个名为 `LightBulbs` 的事物组。  

```
aws iot create-thing-group \
    --thing-group-name LightBulbs \
    --thing-group-properties "thingGroupDescription=\"Generic bulb group\", attributePayload={attributes={Manufacturer=AnyCompany,wattage=60}}"
```
输出：  

```
{
    "thingGroupName": "LightBulbs",
    "thingGroupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/LightBulbs",
    "thingGroupId": "9198bf9f-1e76-4a88-8e8c-e7140142c331"
}
```
**示例 2：创建属于父组的事物组**  
以下 `create-thing-group` 示例创建了一个名为 `HalogenBulbs` 的事物组，其父事物组名为 `LightBulbs`。  

```
aws iot create-thing-group \
    --thing-group-name HalogenBulbs \
    --parent-group-name LightBulbs
```
输出：  

```
{
    "thingGroupName": "HalogenBulbs",
    "thingGroupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/HalogenBulbs",
    "thingGroupId": "f4ec6b84-b42b-499d-9ce1-4dbd4d4f6f6e"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-thing-group.html)*中的。

### `create-thing-type`
<a name="iot_CreateThingType_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-thing-type`。

**AWS CLI**  
**定义事物类型**  
以下 `create-thing-type` 示例定义事物类型和关联的属性。  

```
aws iot create-thing-type \
    --thing-type-name "LightBulb" \
    --thing-type-properties "thingTypeDescription=light bulb type, searchableAttributes=wattage,model"
```
输出：  

```
{
    "thingTypeName": "LightBulb",
    "thingTypeArn": "arn:aws:iot:us-west-2:123456789012:thingtype/LightBulb",
    "thingTypeId": "ce3573b0-0a3c-45a7-ac93-4e0ce14cd190"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[事物类型](https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateThingType](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-thing-type.html)*中的。

### `create-thing`
<a name="iot_CreateThing_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-thing`。

**AWS CLI**  
**示例 1：在注册表中创建事物记录**  
以下`create-thing`示例在 AWS IoT 事物注册表中为设备创建条目。  

```
aws iot create-thing \
    --thing-name SampleIoTThing
```
输出：  

```
{
    "thingName": "SampleIoTThing",
    "thingArn": "arn:aws:iot:us-west-2: 123456789012:thing/SampleIoTThing",
    "thingId": " EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE "
}
```
**示例 2：定义与事物类型关联的事物**  
以下 `create-thing` 示例创建了一个事物，该事物具有指定事物类型及其属性。  

```
aws iot create-thing \
    --thing-name "MyLightBulb" \
    --thing-type-name "LightBulb" \
    --attribute-payload "{"attributes": {"wattage":"75", "model":"123"}}"
```
输出：  

```
{
    "thingName": "MyLightBulb",
    "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb",
    "thingId": "40da2e73-c6af-406e-b415-15acae538797"
}
```
有关更多信息，请参阅*《AWS 物联网开发人员治安》*中的[如何使用注册表管理事物](https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html)和[事物类型](https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-thing.html)*中的。

### `create-topic-rule-destination`
<a name="iot_CreateTopicRuleDestination_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-topic-rule-destination`。

**AWS CLI**  
**创建主题规则目标**  
以下 `create-topic-rule-destination` 示例为 HTTP 端点创建主题规则目标。  

```
aws iot create-topic-rule-destination \
    --destination-configuration httpUrlConfiguration={confirmationUrl=https://example.com}
```
输出：  

```
{
    "topicRuleDestination": {
        "arn": "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
        "status": "IN_PROGRESS",
        "statusReason": "Awaiting confirmation. Confirmation message sent on 2020-07-09T22:47:54.154Z; no response received from the endpoint.",
        "httpUrlProperties": {
            "confirmationUrl": "https://example.com"
        }
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[创建主题规则目标](https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#create-destination)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateTopicRuleDestination](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-topic-rule-destination.html)*中的。

### `create-topic-rule`
<a name="iot_CreateTopicRule_cli_2_topic"></a>

以下代码示例演示了如何使用 `create-topic-rule`。

**AWS CLI**  
**创建发送 Amazon SNS 警报的规则**  
以下 `create-topic-rule` 示例创建了一条规则，当设备影子中发现土壤湿度读数较低时，该规则就会发送 Amazon SNS 消息。  

```
aws iot create-topic-rule \
    --rule-name "LowMoistureRule" \
    --topic-rule-payload file://plant-rule.json
```
该示例要求将以下 JSON 代码保存到名为 `plant-rule.json` 的文件中：  

```
{
    "sql": "SELECT * FROM '$aws/things/MyRPi/shadow/update/accepted' WHERE state.reported.moisture = 'low'\n",
    "description": "Sends an alert whenever soil moisture level readings are too low.",
    "ruleDisabled": false,
    "awsIotSqlVersion": "2016-03-23",
    "actions": [{
            "sns": {
                "targetArn": "arn:aws:sns:us-west-2:123456789012:MyRPiLowMoistureTopic",
                "roleArn": "arn:aws:iam::123456789012:role/service-role/MyRPiLowMoistureTopicRole",
                "messageFormat": "RAW"
            }
    }]
}
```
此命令不生成任何输出。  
有关更多信息，请参阅《[AWS 物联网*开发人员指南》中的创建AWS 物联网*规则](https://docs.aws.amazon.com/iot/latest/developerguide/iot-create-rule.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[CreateTopicRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/create-topic-rule.html)*中的。

### `delete-account-audit-configuration`
<a name="iot_DeleteAccountAuditConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-account-audit-configuration`。

**AWS CLI**  
**为您的 AWS 账户禁用所有审计检查**  
以下`delete-account-audit-configuration`示例恢复该账户的 AWS IoT Device Defender 的默认设置，禁用所有审计检查并清除配置数据。它还删除针对此账户的所有预定审计。**请谨慎使用此命令。**  

```
aws iot delete-account-audit-configuration \
    --delete-scheduled-audits
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteAccountAuditConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-account-audit-configuration.html)*中的。

### `delete-audit-suppression`
<a name="iot_DeleteAuditSuppression_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-audit-suppression`。

**AWS CLI**  
**删除审计调查发现抑制**  
以下 `delete-audit-suppression` 示例删除了 DEVICE\$1CERTIFICATE\$1EXPIRING\$1CHECK 的审计调查发现抑制。  

```
aws iot delete-audit-suppression \
    --check-name DEVICE_CERTIFICATE_EXPIRING_CHECK \
    --resource-identifier deviceCertificateId="c7691e<shortened>"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[审计调查发现抑制](https://docs.aws.amazon.com/iot/latest/developerguide/audit-finding-suppressions.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteAuditSuppression](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-audit-suppression.html)*中的。

### `delete-authorizer`
<a name="iot_DeleteAuthorizer_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-authorizer`。

**AWS CLI**  
**删除自定义授权方**  
以下 `delete-authorizer` 示例删除名为 `CustomAuthorizer` 的授权方。自定义授权方必须处于 `INACTIVE` 状态才能被删除。  

```
aws iot delete-authorizer \
    --authorizer-name CustomAuthorizer
```
此命令不生成任何输出。  
有关更多信息，请参阅[DeleteAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteAuthorizer.html)《*AWS 物联网开发人员指南》*。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-authorizer.html)*中的。

### `delete-billing-group`
<a name="iot_DeleteBillingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-billing-group`。

**AWS CLI**  
**删除账单组**  
以下 `delete-billing-group` 示例删除指定账单组。即使账单组包含一个或多个事物，您也可以将其删除。  

```
aws iot delete-billing-group \
    --billing-group-name BillingGroupTwo
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[账单组](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-billing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteBillingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-billing-group.html)*中的。

### `delete-ca-certificate`
<a name="iot_DeleteCaCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-ca-certificate`。

**AWS CLI**  
**删除 CA 证书**  
以下 `delete-ca-certificate` 示例删除具有指定证书 ID 的 CA 证书。  

```
aws iot delete-ca-certificate \
    --certificate-id f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467
```
此命令不生成任何输出。  
有关更多信息，请参阅 *AWS IoT API 参考CACertificate*中的[删除](https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteCACertificate.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteCaCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-ca-certificate.html)*中的。

### `delete-certificate`
<a name="iot_DeleteCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-certificate`。

**AWS CLI**  
**删除设备证书**  
以下 `delete-certificate` 示例删除具有指定 ID 的设备证书。  

```
aws iot delete-certificate \
    --certificate-id c0c57bbc8baaf4631a9a0345c957657f5e710473e3ddbee1428d216d54d53ac9
```
此命令不生成任何输出。  
有关更多信息，请参阅[DeleteCertificate](https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteCertificate.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-certificate.html)*中的。

### `delete-custom-metric`
<a name="iot_DeleteCustomMetric_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-custom-metric`。

**AWS CLI**  
**删除自定义指标**  
以下 `delete-custom-metric` 示例删除一个自定义指标。  

```
aws iot delete-custom-metric \
    --metric-name batteryPercentage \
    --region us-east-1
```
输出：  

```
HTTP 200
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[自定义指标](https://docs.aws.amazon.com/iot/latest/developerguide/dd-detect-custom-metrics.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteCustomMetric](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-custom-metric.html)*中的。

### `delete-dimension`
<a name="iot_DeleteDimension_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-dimension`。

**AWS CLI**  
**删除维度**  
以下 `delete-dimension` 示例删除名为 `TopicFilterForAuthMessages` 的维度。  

```
aws iot delete-dimension \
    --name TopicFilterForAuthMessages
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteDimension](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-dimension.html)*中的。

### `delete-domain-configuration`
<a name="iot_DeleteDomainConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-domain-configuration`。

**AWS CLI**  
**删除域配置**  
以下`delete-domain-configuration`示例`additionalDataDomain`从您的 AWS 账户中删除名为的域配置。  

```
aws iot delete-domain-configuration \
    --domain-configuration-name "additionalDataDomain" \
    --domain-configuration-status "OK"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[可配置的端点](https://docs.aws.amazon.com/iot/latest/developerguide/iot-custom-endpoints-configurable-aws.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteDomainConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-domain-configuration.html)*中的。

### `delete-dynamic-thing-group`
<a name="iot_DeleteDynamicThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-dynamic-thing-group`。

**AWS CLI**  
**删除动态事物组**  
以下 `delete-dynamic-thing-group` 示例删除指定动态事物组。  

```
aws iot delete-dynamic-thing-group \
    --thing-group-name "RoomTooWarm"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[动态事物组](https://docs.aws.amazon.com/iot/latest/developerguide/dynamic-thing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteDynamicThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-dynamic-thing-group.html)*中的。

### `delete-job-execution`
<a name="iot_DeleteJobExecution_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-job-execution`。

**AWS CLI**  
**删除作业执行**  
以下 `delete-job-execution` 示例删除在设备上执行指定作业。使用 `describe-job-execution` 获取执行编号。  

```
aws iot delete-job-execution
    --job-id "example-job-02"
    --thing-name "MyRaspberryPi"
    --execution-number 1
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteJobExecution](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-job-execution.html)*中的。

### `delete-job`
<a name="iot_DeleteJob_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-job`。

**AWS CLI**  
**删除作业**  
以下 `delete-job` 示例删除指定作业。通过指定 `--force` 选项，即使作业的状态为 `IN_PROGRESS`，也会被删除。  

```
aws iot delete-job \
    --job-id "example-job-04" \
    --force
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-job.html)*中的。

### `delete-mitigation-action`
<a name="iot_DeleteMitigationAction_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-mitigation-action`。

**AWS CLI**  
**删除缓解操作**  
以下 `delete-mitigation-action` 示例删除指定的缓解操作。  

```
aws iot delete-mitigation-action \
    --action-name AddThingsToQuarantineGroup1Action
```
此命令不生成任何输出。  
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [DeleteMitigationAction （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-DeleteMitigationAction)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteMitigationAction](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-mitigation-action.html)*中的。

### `delete-ota-update`
<a name="iot_DeleteOtaUpdate_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-ota-update`。

**AWS CLI**  
**删除 OTA 更新**  
以下 `delete-ota-update` 示例删除指定 OTA 更新。  

```
aws iot delete-ota-update \
    --ota-update-id ota12345 \
    --delete-stream \
    --force-delete-aws-job
```
此命令不生成任何输出。  
有关更多信息，请参阅 *AWS IoT API 参考OTAUpdate*中的[删除](https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteOTAUpdate.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteOtaUpdate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-ota-update.html)*中的。

### `delete-policy-version`
<a name="iot_DeletePolicyVersion_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-policy-version`。

**AWS CLI**  
**删除策略的某个版本**  
以下`delete-policy-version`示例从您的 AWS 账户中删除指定策略的版本 2。  

```
aws iot delete-policy-version \
    --policy-name UpdateDeviceCertPolicy \
    --policy-version-id 2
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的 [AWS IoT 策略](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeletePolicyVersion](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-policy-version.html)*中的。

### `delete-policy`
<a name="iot_DeletePolicy_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-policy`。

**AWS CLI**  
**删除策略**  
以下`delete-policy`示例将从您的 AWS 账户中删除指定的政策。  

```
aws iot delete-policy --policy-name UpdateDeviceCertPolicy
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的 [AWS IoT 策略](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeletePolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-policy.html)*中的。

### `delete-provisioning-template-version`
<a name="iot_DeleteProvisioningTemplateVersion_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-provisioning-template-version`。

**AWS CLI**  
**删除预配模板版本**  
以下 `delete-provisioning-template-version` 示例删除指定预配模板的版本 2。  

```
aws iot delete-provisioning-template-version \
    --version-id 2 \
    --template-name "widget-template"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT Core 开发人员指南》中的 [AWS IoT 安全隧道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteProvisioningTemplateVersion](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-provisioning-template-version.html)*中的。

### `delete-provisioning-template`
<a name="iot_DeleteProvisioningTemplate_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-provisioning-template`。

**AWS CLI**  
**删除预配模板**  
以下 `delete-provisioning-template` 示例删除指定预配模板。  

```
aws iot delete-provisioning-template \
    --template-name widget-template
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT Core 开发人员指南》中的 [AWS IoT 安全隧道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteProvisioningTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-provisioning-template.html)*中的。

### `delete-registration-code`
<a name="iot_DeleteRegistrationCode_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-registration-code`。

**AWS CLI**  
**删除您的注册码**  
以下`delete-registration-code`示例删除了特定于 I AWS oT 账户的注册码。  

```
aws iot delete-registration-code
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[使用您自己的证书](https://docs.aws.amazon.com/iot/latest/developerguide/device-certs-your-own.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteRegistrationCode](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-registration-code.html)*中的。

### `delete-role-alias`
<a name="iot_DeleteRoleAlias_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-role-alias`。

**AWS CLI**  
**删除 Io AWS T 角色别名**  
以下`delete-role-alias`示例删除名为的 I AWS oT 角色别名`LightBulbRole`。  

```
aws iot delete-role-alias \
    --role-alias LightBulbRole
```
此命令不生成任何输出。  
有关更多信息，请参阅《*AWS 物联网开发者指南》*中的[授权直接调用 AWS 服务](https://docs.aws.amazon.com/iot/latest/developerguide/authorizing-direct-aws.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteRoleAlias](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-role-alias.html)*中的。

### `delete-scheduled-audit`
<a name="iot_DeleteScheduledAudit_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-scheduled-audit`。

**AWS CLI**  
**删除预定审计**  
以下`delete-scheduled-audit`示例删除名为的 AWS IoT Device Defender 计划审计`AWSIoTDeviceDefenderDailyAudit`。  

```
aws iot delete-scheduled-audit \
    --scheduled-audit-name AWSIoTDeviceDefenderDailyAudit
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteScheduledAudit](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-scheduled-audit.html)*中的。

### `delete-security-profile`
<a name="iot_DeleteSecurityProfile_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-security-profile`。

**AWS CLI**  
**删除安全配置文件**  
以下 `delete-security-profile` 示例删除名为 `PossibleIssue` 的安全配置文件。  

```
aws iot delete-security-profile \
    --security-profile-name PossibleIssue
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteSecurityProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-security-profile.html)*中的。

### `delete-stream`
<a name="iot_DeleteStream_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-stream`。

**AWS CLI**  
**删除流**  
以下 `delete-stream` 示例删除指定流。  

```
aws iot delete-stream \
    --stream-id stream12345
```
此命令不生成任何输出。  
有关更多信息，请参阅[DeleteStream](https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteStream.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteStream](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-stream.html)*中的。

### `delete-thing-group`
<a name="iot_DeleteThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-thing-group`。

**AWS CLI**  
**删除事物组**  
以下 `delete-thing-group` 示例删除指定事物组。如果事物组中包含子事物组，则无法将其删除。  

```
aws iot delete-thing-group \
    --thing-group-name DefectiveBulbs
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-thing-group.html)*中的。

### `delete-thing-type`
<a name="iot_DeleteThingType_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-thing-type`。

**AWS CLI**  
**示例 1：删除事物类型**  
以下 `delete-thing-type` 示例删除一个已弃用的事物类型。  

```
aws iot delete-thing-type \
    --thing-type-name "obsoleteThingType"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[事物类型](https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteThingType](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-thing-type.html)*中的。

### `delete-thing`
<a name="iot_DeleteThing_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-thing`。

**AWS CLI**  
**显示有关事物的详细信息**  
以下`delete-thing`示例从您 AWS 账户的 AWS IoT 注册表中删除一个事物。  
aws iot 删除-thing-thing-name “” FourthBulb  
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[如何使用注册表管理事物](https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-thing.html)*中的。

### `delete-topic-rule-destination`
<a name="iot_DeleteTopicRuleDestination_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-topic-rule-destination`。

**AWS CLI**  
**删除主题规则目标**  
以下 `delete-topic-rule-destination` 示例删除指定的主题规则目标。  

```
aws iot delete-topic-rule-destination \
    --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[删除主题规则目标](https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#delete-destination)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteTopicRuleDestination](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-topic-rule-destination.html)*中的。

### `delete-topic-rule`
<a name="iot_DeleteTopicRule_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-topic-rule`。

**AWS CLI**  
**删除规则**  
以下 `delete-topic-rule` 示例删除指定规则。  

```
aws iot delete-topic-rule \
    --rule-name "LowMoistureRule"
```
此命令不生成任何输出。  
有关更多信息，请参阅*《AWS 物联网开发人员指南》*中的[删除规则](https://docs.aws.amazon.com/iot/latest/developerguide/iot-delete-rule.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteTopicRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-topic-rule.html)*中的。

### `delete-v2-logging-level`
<a name="iot_DeleteV2LoggingLevel_cli_2_topic"></a>

以下代码示例演示了如何使用 `delete-v2-logging-level`。

**AWS CLI**  
**删除事物组的日志级别**  
以下 `delete-v2-logging-level` 示例删除指定事物组的日志级别。  

```
aws iot delete-v2-logging-level \
    --target-type THING_GROUP \
    --target-name LightBulbs
```
此命令不生成任何输出。  
+  有关 API 的详细信息，请参阅《*AWS CLI 命令*参考》LoggingLevel中的 [deleteV2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/delete-v2-logging-level.html)。

### `deprecate-thing-type`
<a name="iot_DeprecateThingType_cli_2_topic"></a>

以下代码示例演示了如何使用 `deprecate-thing-type`。

**AWS CLI**  
**示例 1：弃用事物类型**  
以下 `deprecate-thing-type` 示例弃用了某一事物类型，因此用户无法将任何新事物与该类型关联。  

```
aws iot deprecate-thing-type \
    --thing-type-name "obsoleteThingType"
```
此命令不生成任何输出。  
**示例 2：撤消对某一事物类型的弃用**  
以下 `deprecate-thing-type` 示例撤消了对某一事物类型的弃用，这样用户就可以再次将新事物与其关联起来。  

```
aws iot deprecate-thing-type \
    --thing-type-name "obsoleteThingType" \
    --undo-deprecate
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[事物类型](https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeprecateThingType](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/deprecate-thing-type.html)*中的。

### `describe-account-audit-configuration`
<a name="iot_DescribeAccountAuditConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-account-audit-configuration`。

**AWS CLI**  
**查看当前的审计配置设置**  
以下`describe-account-audit-configuration`示例列出了您的 AWS IoT Device Defender 审核配置的当前设置。  

```
aws iot describe-account-audit-configuration
```
输出：  

```
{
    "roleArn": "arn:aws:iam::123456789012:role/service-role/AWSIoTDeviceDefenderAudit_1551201085996",
    "auditNotificationTargetConfigurations": {
        "SNS": {
            "targetArn": "arn:aws:sns:us-west-2:123456789012:ddaudits",
            "roleArn": "arn:aws:iam::123456789012:role/service-role/AWSIoTDeviceDefenderAudit",
            "enabled": true
        }
    },
    "auditCheckConfigurations": {
        "AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK": {
            "enabled": true
        },
        "CA_CERTIFICATE_EXPIRING_CHECK": {
            "enabled": true
        },
        "CONFLICTING_CLIENT_IDS_CHECK": {
            "enabled": true
        },
        "DEVICE_CERTIFICATE_EXPIRING_CHECK": {
            "enabled": true
        },
        "DEVICE_CERTIFICATE_SHARED_CHECK": {
            "enabled": true
        },
        "IOT_POLICY_OVERLY_PERMISSIVE_CHECK": {
            "enabled": true
        },
        "LOGGING_DISABLED_CHECK": {
            "enabled": true
        },
        "REVOKED_CA_CERTIFICATE_STILL_ACTIVE_CHECK": {
            "enabled": true
        },
        "REVOKED_DEVICE_CERTIFICATE_STILL_ACTIVE_CHECK": {
            "enabled": true
        },
        "UNAUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK": {
            "enabled": true
        }
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeAccountAuditConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-account-audit-configuration.html)*中的。

### `describe-audit-finding`
<a name="iot_DescribeAuditFinding_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-audit-finding`。

**AWS CLI**  
**列出审计调查发现的详细信息**  
以下`describe-audit-finding`示例列出了指定 AWS IoT Device Defender 审计结果的详细信息。一个审计可以产生多个调查发现。使用 `list-audit-findings` 命令得到一个审计的调查发现列表以获取 `findingId`。  

```
aws iot describe-audit-finding \
    --finding-id "ef4826b8-e55a-44b9-b460-5c485355371b"
```
输出：  

```
{
    "finding": {
        "findingId": "ef4826b8-e55a-44b9-b460-5c485355371b",
        "taskId": "873ed69c74a9ec8fa9b8e88e9abc4661",
        "checkName": "IOT_POLICY_OVERLY_PERMISSIVE_CHECK",
        "taskStartTime": 1576012045.745,
        "findingTime": 1576012046.168,
        "severity": "CRITICAL",
        "nonCompliantResource": {
            "resourceType": "IOT_POLICY",
            "resourceIdentifier": {
                "policyVersionIdentifier": {
                    "policyName": "smp-ggrass-group_Core-policy",
                    "policyVersionId": "1"
                }
            }
         },
        "reasonForNonCompliance": "Policy allows broad access to IoT data plane actions: [iot:Subscribe, iot:Connect, iot:GetThingShadow, iot:DeleteThingShadow, iot:UpdateThingShadow, iot:Publish].",
        "reasonForNonComplianceCode": "ALLOWS_BROAD_ACCESS_TO_IOT_DATA_PLANE_ACTIONS"
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[检查审计结果（审计命令）](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html#device-defender-AuditCommandsFindings)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeAuditFinding](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-audit-finding.html)*中的。

### `describe-audit-mitigation-actions-task`
<a name="iot_DescribeAuditMitigationActionsTask_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-audit-mitigation-actions-task`。

**AWS CLI**  
**显示审计缓解操作任务的详细信息**  
以下 `describe-audit-mitigation-actions-task` 示例显示指定任务的详细信息，其中 `ResetPolicyVersionAction` 应用于一个调查发现。结果包括任务何时开始和结束、针对多少调查发现（以及成果）、作为该任务一部分应用的操作的定义。  

```
aws iot describe-audit-mitigation-actions-task \
    --task-id ResetPolicyTask01
```
输出：  

```
{
    "taskStatus": "COMPLETED",
    "startTime": "2019-12-10T15:13:19.457000-08:00",
    "endTime": "2019-12-10T15:13:19.947000-08:00",
    "taskStatistics": {
        "IOT_POLICY_OVERLY_PERMISSIVE_CHECK": {
            "totalFindingsCount": 1,
            "failedFindingsCount": 0,
            "succeededFindingsCount": 1,
            "skippedFindingsCount": 0,
            "canceledFindingsCount": 0
        }
    },
    "target": {
        "findingIds": [
            "ef4826b8-e55a-44b9-b460-5c485355371b"
        ]
    },
    "auditCheckToActionsMapping": {
        "IOT_POLICY_OVERLY_PERMISSIVE_CHECK": [
            "ResetPolicyVersionAction"
        ]
    },
    "actionsDefinition": [
        {
            "name": "ResetPolicyVersionAction",
            "id": "1ea0b415-bef1-4a01-bd13-72fb63c59afb",
            "roleArn": "arn:aws:iam::123456789012:role/service-role/ReplacePolicyVersionRole",
            "actionParams": {
                "replaceDefaultPolicyVersionParams": {
                    "templateName": "BLANK_POLICY"
                }
            }
        }
    ]
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [DescribeAuditMitigationActionsTask （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-DescribeAuditMitigationActionsTask)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeAuditMitigationActionsTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-audit-mitigation-actions-task.html)*中的。

### `describe-audit-suppression`
<a name="iot_DescribeAuditSuppression_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-audit-suppression`。

**AWS CLI**  
**获取有关审计调查发现抑制的详细信息**  
以下 `describe-audit-suppression` 示例列出有关审计调查发现抑制的详细信息。  

```
aws iot describe-audit-task \
    --task-id "787ed873b69cb4d6cdbae6ddd06996c5"
```
输出：  

```
{
    "taskStatus": "COMPLETED",
    "taskType": "SCHEDULED_AUDIT_TASK",
    "taskStartTime": 1596168096.157,
    "taskStatistics": {
        "totalChecks": 1,
        "inProgressChecks": 0,
        "waitingForDataCollectionChecks": 0,
        "compliantChecks": 0,
        "nonCompliantChecks": 1,
        "failedChecks": 0,
        "canceledChecks": 0
    },
    "scheduledAuditName": "AWSIoTDeviceDefenderDailyAudit",
    "auditDetails": {
        "DEVICE_CERTIFICATE_EXPIRING_CHECK": {
            "checkRunStatus": "COMPLETED_NON_COMPLIANT",
            "checkCompliant": false,
            "totalResourcesCount": 195,
            "nonCompliantResourcesCount": 2
        }
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[审计调查发现抑制](https://docs.aws.amazon.com/iot/latest/developerguide/audit-finding-suppressions.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeAuditSuppression](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-audit-suppression.html)*中的。

### `describe-audit-task`
<a name="iot_DescribeAuditTask_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-audit-task`。

**AWS CLI**  
**获取有关审计实例的信息**  
以下`describe-audit-task`示例获取有关 AWS IoT Device Defender 审计实例的信息。如果审计完成，结果中将包括运行的汇总统计信息。  

```
aws iot describe-audit-task \
    --task-id a3aea009955e501a31b764abe1bebd3d
```
输出：  

```
 {
    "taskStatus": "COMPLETED",
    "taskType": "ON_DEMAND_AUDIT_TASK",
    "taskStartTime": 1560356923.434,
    "taskStatistics": {
        "totalChecks": 3,
        "inProgressChecks": 0,
        "waitingForDataCollectionChecks": 0,
        "compliantChecks": 3,
        "nonCompliantChecks": 0,
        "failedChecks": 0,
        "canceledChecks": 0
    },
    "auditDetails": {
        "CA_CERTIFICATE_EXPIRING_CHECK": {
            "checkRunStatus": "COMPLETED_COMPLIANT",
            "checkCompliant": true,
            "totalResourcesCount": 0,
            "nonCompliantResourcesCount": 0
        },
        "DEVICE_CERTIFICATE_EXPIRING_CHECK": {
            "checkRunStatus": "COMPLETED_COMPLIANT",
            "checkCompliant": true,
            "totalResourcesCount": 6,
            "nonCompliantResourcesCount": 0
        },
        "REVOKED_CA_CERTIFICATE_STILL_ACTIVE_CHECK": {
            "checkRunStatus": "COMPLETED_COMPLIANT",
            "checkCompliant": true,
            "totalResourcesCount": 0,
            "nonCompliantResourcesCount": 0
        }
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeAuditTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-audit-task.html)*中的。

### `describe-authorizer`
<a name="iot_DescribeAuthorizer_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-authorizer`。

**AWS CLI**  
**获取有关自定义授权方的信息**  
以下 `describe-authorizer` 示例显示指定自定义授权方的详细信息。  

```
aws iot describe-authorizer \
    --authorizer-name CustomAuthorizer
```
输出：  

```
{
    "authorizerDescription": {
        "authorizerName": "CustomAuthorizer",
        "authorizerArn": "arn:aws:iot:us-west-2:123456789012:authorizer/CustomAuthorizer",
        "authorizerFunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:CustomAuthorizerFunction",
        "tokenKeyName": "MyAuthToken",
        "tokenSigningPublicKeys": {
            "FIRST_KEY": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1uJOB4lQPgG/lM6ZfIwo\nZ+7ENxAio9q6QD4FFqjGZsvjtYwjoe1RKK0U8Eq9xb5O3kRSmyIwTzwzm/f4Gf0Y\nZUloJ+t3PUUwHrmbYTAgTrCUgRFygjfgVwGCPs5ZAX4Eyqt5cr+AIHIiUDbxSa7p\nzwOBKPeic0asNJpqT8PkBbRaKyleJh5oo81NDHHmVtbBm5A5YiJjqYXLaVAowKzZ\n+GqsNvAQ9Jy1wI2VrEa1OfL8flDB/BJLm7zjpfPOHDJQgID0XnZwAlNnZcOhCwIx\n50g2LW2Oy9R/dmqtDmJiVP97Z4GykxPvwlYHrUXY0iW1R3AR/Ac1NhCTGZMwVDB1\nlQIDAQAB\n-----END PUBLIC KEY-----"
        },
        "status": "ACTIVE",
        "creationDate": 1571245658.069,
        "lastModifiedDate": 1571245658.069
    }
}
```
有关更多信息，请参阅[DescribeAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeAuthorizer.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-authorizer.html)*中的。

### `describe-billing-group`
<a name="iot_DescribeBillingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-billing-group`。

**AWS CLI**  
**获取有关账单组的信息**  
以下 `describe-billing-group` 示例获取指定账单组的信息。  

```
aws iot describe-billing-group --billing-group-name GroupOne
```
输出：  

```
{
    "billingGroupName": "GroupOne",
    "billingGroupId": "103de383-114b-4f51-8266-18f209ef5562",
    "billingGroupArn": "arn:aws:iot:us-west-2:123456789012:billinggroup/GroupOne",
    "version": 1,
    "billingGroupProperties": {},
    "billingGroupMetadata": {
        "creationDate": 1560199355.378
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[账单组](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-billing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeBillingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-billing-group.html)*中的。

### `describe-ca-certificate`
<a name="iot_DescribeCaCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-ca-certificate`。

**AWS CLI**  
**获取有关 CA 证书的详细信息**  
以下 `describe-ca-certificate` 示例显示指定 CA 证书的详细信息。  

```
aws iot describe-ca-certificate \
    --certificate-id f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467
```
输出：  

```
{
    "certificateDescription": {
        "certificateArn": "arn:aws:iot:us-west-2:123456789012:cacert/f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467",
        "certificateId": "f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467",
        "status": "INACTIVE",
        "certificatePem": "-----BEGIN CERTIFICATE-----\nMIICzzCCAbegEXAMPLEJANVEPWXl8taPMA0GCSqGSIb3DQEBBQUAMB4xCzAJBgNV\nBAYTAlVTMQ8wDQYDVQQKDAZBbWF6b24wHhcNMTkwOTI0MjEzMTE1WhcNMjkwOTIx\nMjEzMTE1WjAeMQswCQYDVQQGEwJVUzEPMA0GA1UECgwGQW1hem9uMIIBIjANBgkq\nhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzd3R3ioalCS0MhFWfBrVGR036EK07UAf\nVdz9EXAMPLE1VczICbADnATK522kEIB51/18VzlFtAhQL5V5eybXKnB7QebNer5m\n4Yibx7shR5oqNzFsrXWxuugN5+w5gEfqNMawOjhF4LsculKG49yuqjcDU19/13ua\n3B2gxs1Pe7TiWWvUskzxnbO1F2WCshbEJvqY8fIWtGYCjTeJAgQ9hvZx/69XhKen\nwV9LJwOQxrsUS0Ty8IHwbB8fRy72VM3u7fJoaU+nO4jD5cqaoEPtzoeFUEXAMPLE\nyVAJpqHwgbYbcUfn7V+AB6yh1+0Fa1rEQGuZDPGyJslxwr5vh8nRewIDAQABoxAw\nDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQA+3a5CV3IJgOnd0AgI\nBgVMtmYzTvqAngx26aG9/spvCjXckh2SBF+EcBlCFwH1yakwjJL1dR4yarnrfxgI\nEqP4AOYVimAVoQ5FBwnloHe16+3qtDiblU9DeXBUCtS55EcfrEXAMPLEYtXdqU5C\nU9ia4KAjV0dxW1+EFYMwX5eGeb0gDTNHBylV6B/fOSZiQAwDYp4x3B+gAP+a/bWB\nu1umOqtBdWe6L6/83L+JhaTByqV25iVJ4c/UZUnG8926wUlDM9zQvEXuEVvzZ7+m\n4PSNqst/nVOvnLpoG4e0WgcJgANuB33CSWtjWSuYsbhmqQRknGhREXAMPLEZT4fm\nfo0e\n-----END CERTIFICATE-----\n",
        "ownedBy": "123456789012",
        "creationDate": 1569365372.053,
        "autoRegistrationStatus": "DISABLE",
        "lastModifiedDate": 1569365372.053,
        "customerVersion": 1,
        "generationId": "c5c2eb95-140b-4f49-9393-6aaac85b2a90",
        "validity": {
            "notBefore": 1569360675.0,
            "notAfter": 1884720675.0
        }
    }
}
```
有关更多信息，请参阅 *AWS IoT API 参考CACertificate*中的[描述](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeCACertificate.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeCaCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-ca-certificate.html)*中的。

### `describe-certificate`
<a name="iot_DescribeCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-certificate`。

**AWS CLI**  
**获取有关证书的信息**  
以下 `describe-certificate` 示例显示指定证书的详细信息。  

```
aws iot describe-certificate \
    --certificate-id "4f0ba725787aa94d67d2fca420eca022242532e8b3c58e7465c7778b443fd65e"
```
输出：  

```
{
    "certificateDescription": {
        "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/4f0ba725787aa94d67d2fca420eca022242532e8b3c58e7465c7778b443fd65e",
        "certificateId": "4f0ba725787aa94d67d2fca420eca022242532e8b3c58e7465c7778b443fd65e",
        "status": "ACTIVE",
        "certificatePem": "-----BEGIN CERTIFICATE-----
MIICiTEXAMPLEQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMC
VVMxCzAJBgNVBEXAMPLEMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6
b24xFDASBgNVBAsTC0lBTSBDEXAMPLElMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAd
BgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5EXAMPLEcNMTEwNDI1MjA0NTIxWhcN
MTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNEXAMPLEdBMRAwDgYD
VQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBEXAMPLEz
b2xEXAMPLEYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFt
YXpvbi5jb20wgZ8EXAMPLEZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ
21uUSfwfEvySWtC2XADZ4nB+BLYEXAMPLEpiwsZ3G93vUEIO3IyNoH/f0wYK8m9T
rDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7EXAMPLEGBzZswY6786m86gpE
Ibb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFEXAMPLEAtCu4
nUhVVxYUnEXAMPLE8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0Fkb
FFBjvSfpJIlJ00zbhNYS5f6GEXAMPLEl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTb
NYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=
-----END CERTIFICATE-----",
        "ownedBy": "123456789012",
        "creationDate": 1541022751.983,
        "lastModifiedDate": 1541022751.983,
        "customerVersion": 1,
        "transferData": {},
        "generationId": "6974fbed-2e61-4114-bc5e-4204cc79b045",
        "validity": {
            "notBefore": 1541022631.0,
            "notAfter": 2524607999.0
        }
    }
}
```
有关更多信息，请参阅[DescribeCertificate](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeCertificate.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-certificate.html)*中的。

### `describe-custom-metric`
<a name="iot_DescribeCustomMetric_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-custom-metric`。

**AWS CLI**  
**获取有关 Device Defender 自定义指标的信息**  
以下 `describe-custom-metric` 示例获取有关名为 `myCustomMetric` 的自定义指标的信息。  

```
aws iot describe-custom-metric \
    --metric-name myCustomMetric
```
输出：  

```
{
    "metricName": "myCustomMetric",
    "metricArn": "arn:aws:iot:us-east-1:1234564789012:custommetric/myCustomMetric",
    "metricType": "number",
    "displayName": "My custom metric",
    "creationDate": 2020-11-17T23:02:12.879000-09:00,
    "lastModifiedDate": 2020-11-17T23:02:12.879000-09:00
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[自定义指标](https://docs.aws.amazon.com/iot/latest/developerguide/dd-detect-custom-metrics.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeCustomMetric](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-custom-metric.html)*中的。

### `describe-default-authorizer`
<a name="iot_DescribeDefaultAuthorizer_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-default-authorizer`。

**AWS CLI**  
**获取有关默认自定义授权方的信息**  
以下 `describe-default-authorizer` 示例显示默认自定义授权方的详细信息。  

```
aws iot describe-default-authorizer
```
输出：  

```
{
    "authorizerName": "CustomAuthorizer",
    "authorizerArn": "arn:aws:iot:us-west-2:123456789012:authorizer/CustomAuthorizer"
}
```
有关更多信息，请参阅[DescribeDefaultAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeDefautAuthorizer.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeDefaultAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-default-authorizer.html)*中的。

### `describe-dimension`
<a name="iot_DescribeDimension_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-dimension`。

**AWS CLI**  
**获取有关维度的信息**  
以下 `describe-dimension` 示例获取有关名为 `TopicFilterForAuthMessages` 的维度的信息。  

```
aws iot describe-dimension \
    --name TopicFilterForAuthMessages
```
输出：  

```
{
    "name": "TopicFilterForAuthMessages",
    "arn": "arn:aws:iot:eu-west-2:123456789012:dimension/TopicFilterForAuthMessages",
    "type": "TOPIC_FILTER",
    "stringValues": [
        "device/+/auth"
    ],
    "creationDate": 1578620223.255,
    "lastModifiedDate": 1578620223.255
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeDimension](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-dimension.html)*中的。

### `describe-domain-configuration`
<a name="iot_DescribeDomainConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-domain-configuration`。

**AWS CLI**  
**描述域配置**  
以下 `describe-domain-configuration` 示例显示有关指定域配置的详细信息。  

```
aws iot describe-domain-configuration \
    --domain-configuration-name "additionalDataDomain"
```
输出：  

```
{
    "domainConfigurationName": "additionalDataDomain",
    "domainConfigurationArn": "arn:aws:iot:us-east-1:758EXAMPLE143:domainconfiguration/additionalDataDomain/norpw",
    "domainName": "d055exampleed74y71zfd-ats.beta.us-east-1.iot.amazonaws.com",
    "serverCertificates": [],
    "domainConfigurationStatus": "ENABLED",
    "serviceType": "DATA",
    "domainType": "AWS_MANAGED",
    "lastStatusChangeDate": 1601923783.774
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[可配置的端点](https://docs.aws.amazon.com/iot/latest/developerguide/iot-custom-endpoints-configurable-aws.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeDomainConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-domain-configuration.html)*中的。

### `describe-endpoint`
<a name="iot_DescribeEndpoint_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-endpoint`。

**AWS CLI**  
**示例 1：获取您当前的 AWS 终端节点**  
以下`describe-endpoint`示例检索应用所有命令的默认 AWS 端点。  

```
aws iot describe-endpoint
```
输出：  

```
{
    "endpointAddress": "abc123defghijk.iot.us-west-2.amazonaws.com"
}
```
有关更多信息，请参阅[DescribeEndpoint](https://docs.aws.amazon.com/iot/latest/developerguide/iot-commands.html#api-iot-DescribeEndpoint)《*AWS 物联网开发人员指南》*。  
**示例 2：获取您的 ATS 端点**  
以下 `describe-endpoint` 示例检索 Amazon Trust Services（ATS）端点。  

```
aws iot describe-endpoint \
    --endpoint-type iot:Data-ATS
```
输出：  

```
{
    "endpointAddress": "abc123defghijk-ats.iot.us-west-2.amazonaws.com"
}
```
有关更多信息，请参阅《物联网开发者指南》中的 [X.509 证书和物 AWS*AWS 联*](https://docs.aws.amazon.com/iot/latest/developerguide/managing-device-certs.html)网。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeEndpoint](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-endpoint.html)*中的。

### `describe-event-configurations`
<a name="iot_DescribeEventConfigurations_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-event-configurations`。

**AWS CLI**  
**显示已发布的事件类型**  
以下 `describe-event-configurations` 示例列出了控制添加、更新或删除内容时生成哪些事件的配置。  

```
aws iot describe-event-configurations
```
输出：  

```
{
    "eventConfigurations": {
        "CA_CERTIFICATE": {
            "Enabled": false
        },
        "CERTIFICATE": {
            "Enabled": false
        },
        "JOB": {
            "Enabled": false
        },
        "JOB_EXECUTION": {
            "Enabled": false
        },
        "POLICY": {
            "Enabled": false
        },
        "THING": {
            "Enabled": false
        },
        "THING_GROUP": {
            "Enabled": false
        },
        "THING_GROUP_HIERARCHY": {
            "Enabled": false
        },
        "THING_GROUP_MEMBERSHIP": {
            "Enabled": false
        },
        "THING_TYPE": {
            "Enabled": false
        },
        "THING_TYPE_ASSOCIATION": {
            "Enabled": false
        }
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事件消息](https://docs.aws.amazon.com/iot/latest/developerguide/iot-events.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeEventConfigurations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-event-configurations.html)*中的。

### `describe-index`
<a name="iot_DescribeIndex_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-index`。

**AWS CLI**  
**检索事物索引的当前状态**  
以下 `describe-index` 示例检索事物索引的当前状态。  

```
aws iot describe-index \
    --index-name "AWS_Things"
```
输出：  

```
{
    "indexName": "AWS_Things",
    "indexStatus": "ACTIVE",
    "schema": "REGISTRY_AND_SHADOW_AND_CONNECTIVITY_STATUS"
}
```
有关更多信息，请参阅《AWS 物联网开发人员指南》**中的[管理事物索引](https://docs.aws.amazon.com/iot/latest/developerguide/managing-index.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeIndex](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-index.html)*中的。

### `describe-job-execution`
<a name="iot_DescribeJobExecution_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-job-execution`。

**AWS CLI**  
**获取设备上作业的执行详细信息**  
以下 `describe-job-execution` 示例获取指定作业的执行详细信息。  

```
aws iot describe-job-execution \
    --job-id "example-job-01" \
    --thing-name "MyRaspberryPi"
```
输出：  

```
{
    "execution": {
        "jobId": "example-job-01",
        "status": "QUEUED",
        "statusDetails": {},
        "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyRaspberryPi",
        "queuedAt": 1560787023.636,
        "lastUpdatedAt": 1560787023.636,
        "executionNumber": 1,
        "versionNumber": 1
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeJobExecution](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-job-execution.html)*中的。

### `describe-job`
<a name="iot_DescribeJob_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-job`。

**AWS CLI**  
**获取作业的详细状态**  
以下 `describe-job` 示例获取 ID 为 `example-job-01` 的作业的详细状态。  

```
aws iot describe-job \
    --job-id "example-job-01"
```
输出：  

```
{
    "job": {
        "jobArn": "arn:aws:iot:us-west-2:123456789012:job/example-job-01",
        "jobId": "example-job-01",
        "targetSelection": "SNAPSHOT",
        "status": "IN_PROGRESS",
        "targets": [
            "arn:aws:iot:us-west-2:123456789012:thing/MyRaspberryPi"
        ],
        "description": "example job test",
        "presignedUrlConfig": {},
        "jobExecutionsRolloutConfig": {},
        "createdAt": 1560787022.733,
        "lastUpdatedAt": 1560787026.294,
        "jobProcessDetails": {
            "numberOfCanceledThings": 0,
            "numberOfSucceededThings": 0,
            "numberOfFailedThings": 0,
            "numberOfRejectedThings": 0,
            "numberOfQueuedThings": 1,
            "numberOfInProgressThings": 0,
            "numberOfRemovedThings": 0,
            "numberOfTimedOutThings": 0
        },
        "timeoutConfig": {}
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-job.html)*中的。

### `describe-mitigation-action`
<a name="iot_DescribeMitigationAction_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-mitigation-action`。

**AWS CLI**  
**查看已定义的缓解操作的详细信息**  
以下 `describe-mitigation-action` 示例显示指定缓解操作的详细信息。  

```
aws iot describe-mitigation-action \
    --action-name AddThingsToQuarantineGroupAction
```
输出：  

```
{
    "actionName": "AddThingsToQuarantineGroupAction",
    "actionType": "ADD_THINGS_TO_THING_GROUP",
    "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/AddThingsToQuarantineGroupAction",
    "actionId": "2fd2726d-98e1-4abf-b10f-09465ccd6bfa",
    "roleArn": "arn:aws:iam::123456789012:role/service-role/MoveThingsToQuarantineGroupRole",
    "actionParams": {
        "addThingsToThingGroupParams": {
            "thingGroupNames": [
                "QuarantineGroup1"
            ],
            "overrideDynamicGroups": true
        }
    },
    "creationDate": "2019-12-10T11:09:35.999000-08:00",
    "lastModifiedDate": "2019-12-10T11:09:35.999000-08:00"
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [DescribeMitigationAction （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-DescribeMitigationAction)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeMitigationAction](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-mitigation-action.html)*中的。

### `describe-provisioning-template-version`
<a name="iot_DescribeProvisioningTemplateVersion_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-provisioning-template-version`。

**AWS CLI**  
**描述预配模板版本**  
以下 `describe-provisioning-template-version` 示例描述一个预配模板版本。  

```
aws iot describe-provisioning-template-version \
    --template-name MyTestProvisioningTemplate \
    --version-id 1
```
输出：  

```
{
    "versionId": 1,
    "creationDate": 1589308310.574,
    "templateBody": "{
        \"Parameters\":{
            \"SerialNumber\":{
                \"Type\":\"String\"
            },
            \"AWS::IoT::Certificate::Id\":{
                \"Type\":\"String\"
            }
        },
        \"Resources\":{
            \"certificate\":{
                \"Properties\":{
                    \"CertificateId\":{
                        \"Ref\":\"AWS::IoT::Certificate::Id\"
                    },
                    \"Status\":\"Active\"
                },
                \"Type\":\"AWS::IoT::Certificate\"
            },
            \"policy\":{
                \"Properties\":{
                    \"PolicyName\":\"MyIotPolicy\"
                },
                \"Type\":\"AWS::IoT::Policy\"
            },
            \"thing\":{
                \"OverrideSettings\":{
                    \"AttributePayload\":\"MERGE\",
                    \"ThingGroups\":\"DO_NOTHING\",
                    \"ThingTypeName\":\"REPLACE\"
                },
                \"Properties\":{
                    \"AttributePayload\":{},
                    \"ThingGroups\":[],
                    \"ThingName\":{
                        \"Fn::Join\":[
                            \"\",
                            [
                                \"DemoGroup_\",
                                {\"Ref\":\"SerialNumber\"}
                            ]
                        ]
                    },
                    \"ThingTypeName\":\"VirtualThings\"
                },
                \"Type\":\"AWS::IoT::Thing\"
            }
        }
    }",
    "isDefaultVersion": true
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[使用实例集预配来预配没有设备证书的设备](https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeProvisioningTemplateVersion](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-provisioning-template-version.html)*中的。

### `describe-provisioning-template`
<a name="iot_DescribeProvisioningTemplate_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-provisioning-template`。

**AWS CLI**  
**描述预配模板**  
以下 `describe-provisioning-template` 示例描述一个预配模板。  

```
aws iot describe-provisioning-template \
    --template-name MyTestProvisioningTemplate
```
输出：  

```
{
    "templateArn": "arn:aws:iot:us-west-2:57EXAMPLE833:provisioningtemplate/MyTestProvisioningTemplate",
    "templateName": "MyTestProvisioningTemplate",
    "creationDate": 1589308310.574,
    "lastModifiedDate": 1589308345.539,
    "defaultVersionId": 1,
    "templateBody": "{
        \"Parameters\":{
            \"SerialNumber\":{
                \"Type\":\"String\"
            },
            \"AWS::IoT::Certificate::Id\":{
                \"Type\":\"String\"
            }
        },
        \"Resources\":{
            \"certificate\":{
                \"Properties\":{
                    \"CertificateId\":{
                        \"Ref\":\"AWS::IoT::Certificate::Id\"
                    },
                    \"Status\":\"Active\"
                },
                \"Type\":\"AWS::IoT::Certificate\"
            },
            \"policy\":{
                \"Properties\":{
                    \"PolicyName\":\"MyIotPolicy\"
                },
                \"Type\":\"AWS::IoT::Policy\"
            },
            \"thing\":{
                \"OverrideSettings\":{
                    \"AttributePayload\":\"MERGE\",
                    \"ThingGroups\":\"DO_NOTHING\",
                    \"ThingTypeName\":\"REPLACE\"
                },
                \"Properties\":{
                    \"AttributePayload\":{},
                    \"ThingGroups\":[],
                    \"ThingName\":{
                        \"Fn::Join\":[
                            \"\",
                            [
                                \"DemoGroup_\",
                                {\"Ref\":\"SerialNumber\"}
                            ]
                        ]
                    },
                    \"ThingTypeName\":\"VirtualThings\"
                },
                \"Type\":\"AWS::IoT::Thing\"
            }
        }
    }",
    "enabled": true,
    "provisioningRoleArn": "arn:aws:iam::571032923833:role/service-role/IoT_access"
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[使用实例集预配来预配没有设备证书的设备](https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeProvisioningTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-provisioning-template.html)*中的。

### `describe-role-alias`
<a name="iot_DescribeRoleAlias_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-role-alias`。

**AWS CLI**  
**获取有关 AWS IoT 角色别名的信息**  
以下 `describe-role-alias` 示例显示指定角色别名的详细信息。  

```
aws iot describe-role-alias \
    --role-alias LightBulbRole
```
输出：  

```
{
    "roleAliasDescription": {
        "roleAlias": "LightBulbRole",
        "roleAliasArn": "arn:aws:iot:us-west-2:123456789012:rolealias/LightBulbRole",
        "roleArn": "arn:aws:iam::123456789012:role/light_bulb_role_001",
        "owner": "123456789012",
        "credentialDurationSeconds": 3600,
        "creationDate": 1570558643.221,
        "lastModifiedDate": 1570558643.221
    }
}
```
有关更多信息，请参阅[DescribeRoleAlias](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeRoleAlias.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeRoleAlias](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-role-alias.html)*中的。

### `describe-scheduled-audit`
<a name="iot_DescribeScheduledAudit_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-scheduled-audit`。

**AWS CLI**  
**获取有关预定审计的信息**  
以下`describe-scheduled-audit`示例获取有关名为的 AWS IOT Device Defender 计划审核的详细信息`AWSIoTDeviceDefenderDailyAudit`。  

```
aws iot describe-scheduled-audit \
    --scheduled-audit-name AWSIoTDeviceDefenderDailyAudit
```
输出：  

```
{
    "frequency": "DAILY",
    "targetCheckNames": [
        "AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK",
        "CONFLICTING_CLIENT_IDS_CHECK",
        "DEVICE_CERTIFICATE_SHARED_CHECK",
        "IOT_POLICY_OVERLY_PERMISSIVE_CHECK",
        "REVOKED_CA_CERTIFICATE_STILL_ACTIVE_CHECK",
        "UNAUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK"
    ],
    "scheduledAuditName": "AWSIoTDeviceDefenderDailyAudit",
    "scheduledAuditArn": "arn:aws:iot:us-west-2:123456789012:scheduledaudit/AWSIoTDeviceDefenderDailyAudit"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeScheduledAudit](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-scheduled-audit.html)*中的。

### `describe-security-profile`
<a name="iot_DescribeSecurityProfile_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-security-profile`。

**AWS CLI**  
**获取有关安全配置文件的信息**  
以下`describe-security-profile`示例获取有关名为 AWS IoT Device Defender 安全配置文件的信息 `PossibleIssue.`  

```
aws iot describe-security-profile \
    --security-profile-name PossibleIssue
```
输出：  

```
{
    "securityProfileName": "PossibleIssue",
    "securityProfileArn": "arn:aws:iot:us-west-2:123456789012:securityprofile/PossibleIssue",
    "securityProfileDescription": "check to see if authorization fails 10 times in 5 minutes or if cellular bandwidth exceeds 128",
    "behaviors": [
        {
            "name": "CellularBandwidth",
            "metric": "aws:message-byte-size",
            "criteria": {
                "comparisonOperator": "greater-than",
                "value": {
                    "count": 128
                },
                "consecutiveDatapointsToAlarm": 1,
                "consecutiveDatapointsToClear": 1
            }
        },
        {
            "name": "Authorization",
            "metric": "aws:num-authorization-failures",
            "criteria": {
                "comparisonOperator": "greater-than",
                "value": {
                    "count": 10
                },
                "durationSeconds": 300,
                "consecutiveDatapointsToAlarm": 1,
                "consecutiveDatapointsToClear": 1
            }
        }
    ],
    "version": 1,
    "creationDate": 1560278102.528,
    "lastModifiedDate": 1560278102.528
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeSecurityProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-security-profile.html)*中的。

### `describe-stream`
<a name="iot_DescribeStream_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-stream`。

**AWS CLI**  
**获取有关直播的信息**  
以下 `describe-stream` 示例显示有关指定流的详细信息。  

```
aws iot describe-stream \
    --stream-id stream12345
```
输出：  

```
{
    "streamInfo": {
        "streamId": "stream12345",
        "streamArn": "arn:aws:iot:us-west-2:123456789012:stream/stream12345",
        "streamVersion": 1,
        "description": "This stream is used for Amazon FreeRTOS OTA Update 12345.",
        "files": [
            {
                "fileId": "123",
                "s3Location": {
                    "bucket":"codesign-ota-bucket",
                    "key":"48c67f3c-63bb-4f92-a98a-4ee0fbc2bef6"
                }
            }
        ],
        "createdAt": 1557863215.995,
        "lastUpdatedAt": 1557863215.995,
        "roleArn": "arn:aws:iam:123456789012:role/service-role/my_ota_stream_role"
    }
}
```
有关更多信息，请参阅[DescribeStream](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeStream.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeStream](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-stream.html)*中的。

### `describe-thing-group`
<a name="iot_DescribeThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-thing-group`。

**AWS CLI**  
**获取有关事物组的信息**  
以下 `describe-thing-group` 示例获取有关名为 `HalogenBulbs` 的事物组的信息。  

```
aws iot describe-thing-group \
    --thing-group-name HalogenBulbs
```
输出：  

```
{
    "thingGroupName": "HalogenBulbs",
    "thingGroupId": "f4ec6b84-b42b-499d-9ce1-4dbd4d4f6f6e",
    "thingGroupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/HalogenBulbs",
    "version": 1,
    "thingGroupProperties": {},
    "thingGroupMetadata": {
        "parentGroupName": "LightBulbs",
        "rootToParentThingGroups": [
            {
                "groupName": "LightBulbs",
                "groupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/LightBulbs"
            }
        ],
        "creationDate": 1559927609.897
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-thing-group.html)*中的。

### `describe-thing-type`
<a name="iot_DescribeThingType_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-thing-type`。

**AWS CLI**  
**获取有关某一事物类型的信息**  
以下`describe-thing-type`示例显示有关您的 AWS 账户中定义的指定事物类型的信息。  

```
aws iot describe-thing-type \
    --thing-type-name "LightBulb"
```
输出：  

```
{
    "thingTypeName": "LightBulb",
    "thingTypeId": "ce3573b0-0a3c-45a7-ac93-4e0ce14cd190",
    "thingTypeArn": "arn:aws:iot:us-west-2:123456789012:thingtype/LightBulb",
    "thingTypeProperties": {
        "thingTypeDescription": "light bulb type",
        "searchableAttributes": [
            "model",
            "wattage"
        ]
    },
    "thingTypeMetadata": {
        "deprecated": false,
        "creationDate": 1559772562.498
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[事物类型](https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeThingType](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-thing-type.html)*中的。

### `describe-thing`
<a name="iot_DescribeThing_cli_2_topic"></a>

以下代码示例演示了如何使用 `describe-thing`。

**AWS CLI**  
**显示有关事物的详细信息**  
以下`describe-thing`示例显示有关在您的 AWS 账户的 AWS IoT 注册表中定义的事物（设备）的信息。  
aws iot 描述-thing-thing-name “” MyLightBulb  
输出：  

```
{
    "defaultClientId": "MyLightBulb",
    "thingName": "MyLightBulb",
    "thingId": "40da2e73-c6af-406e-b415-15acae538797",
    "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb",
    "thingTypeName": "LightBulb",
    "attributes": {
        "model": "123",
        "wattage": "75"
    },
    "version": 1
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[如何使用注册表管理事物](https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-thing.html)*中的。

### `detach-policy`
<a name="iot_DetachPolicy_cli_2_topic"></a>

以下代码示例演示了如何使用 `detach-policy`。

**AWS CLI**  
**示例 1：将 I AWS oT 策略与事物组分离**  
以下 `detach-policy` 示例将指定策略与一个事物组分离，进而与该事物组中的所有事物以及该组的任何子组分离。  

```
aws iot detach-policy \
    --target "arn:aws:iot:us-west-2:123456789012:thinggroup/LightBulbs" \
    --policy-name "MyFirstGroup_Core-policy"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
**示例 2：将 AWS 物联网策略与设备证书分离**  
以下`detach-policy`示例将 TemperatureSensorPolicy 策略与 ARN 标识的设备证书分离。  

```
aws iot detach-policy \
    --policy-name TemperatureSensorPolicy \
    --target arn:aws:iot:us-west-2:123456789012:cert/488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142
```
此命令不生成任何输出。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DetachPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/detach-policy.html)*中的。

### `detach-security-profile`
<a name="iot_DetachSecurityProfile_cli_2_topic"></a>

以下代码示例演示了如何使用 `detach-security-profile`。

**AWS CLI**  
**取消安全配置文件与目标的关联**  
以下`detach-security-profile`示例删除了名为的 AWS IoT Device Defender 安全配置文件`Testprofile`与所有已注册事物目标之间的关联。  

```
aws iot detach-security-profile \
    --security-profile-name Testprofile \
    --security-profile-target-arn "arn:aws:iot:us-west-2:123456789012:all/registered-things"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DetachSecurityProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/detach-security-profile.html)*中的。

### `detach-thing-principal`
<a name="iot_DetachThingPrincipal_cli_2_topic"></a>

以下代码示例演示了如何使用 `detach-thing-principal`。

**AWS CLI**  
**将与事物 certificate/principal 分离**  
以下 `detach-thing-principal` 示例从指定事物中移除代表一个主体的证书。  

```
aws iot detach-thing-principal \
    --thing-name "MyLightBulb" \
    --principal "arn:aws:iot:us-west-2:123456789012:cert/604c48437a57b7d5fc5d137c5be75011c6ee67c9a6943683a1acb4b1626bac36"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[如何使用注册表管理事物](https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DetachThingPrincipal](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/detach-thing-principal.html)*中的。

### `disable-topic-rule`
<a name="iot_DisableTopicRule_cli_2_topic"></a>

以下代码示例演示了如何使用 `disable-topic-rule`。

**AWS CLI**  
**禁用主题规则**  
以下 `disable-topic-rule` 示例禁用指定主题规则。  

```
aws iot disable-topic-rule \
    --rule-name "MyPlantPiMoistureAlertRule"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[查看您的规则](https://docs.aws.amazon.com/iot/latest/developerguide/iot-view-rules.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DisableTopicRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/disable-topic-rule.html)*中的。

### `enable-topic-rule`
<a name="iot_EnableTopicRule_cli_2_topic"></a>

以下代码示例演示了如何使用 `enable-topic-rule`。

**AWS CLI**  
**启用主题规则**  
以下 `enable-topic-rule` 示例启用（或重新启用）指定的主题规则。  

```
aws iot enable-topic-rule \
    --rule-name "MyPlantPiMoistureAlertRule"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[查看您的规则](https://docs.aws.amazon.com/iot/latest/developerguide/iot-view-rules.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[EnableTopicRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/enable-topic-rule.html)*中的。

### `get-behavior-model-training-summaries`
<a name="iot_GetBehaviorModelTrainingSummaries_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-behavior-model-training-summaries`。

**AWS CLI**  
**列出 Device Defender 的 ML Detect 安全配置文件训练模型的状态**  
以下 `get-behavior-model-training-summaries` 示例列出所选安全配置文件中已配置行为的模型训练状态。对于每种行为，都会列出名称、模型状态和收集的数据点百分比。  

```
aws iot get-behavior-model-training-summaries \
    --security-profile-name MySecuirtyProfileName
```
输出：  

```
{
    "summaries": [
        {
            "securityProfileName": "MySecuirtyProfileName",
            "behaviorName": "Messages_sent_ML_behavior",
            "modelStatus": "PENDING_BUILD",
            "datapointsCollectionPercentage": 0.0
        },
        {
            "securityProfileName": "MySecuirtyProfileName",
            "behaviorName": "Messages_received_ML_behavior",
            "modelStatus": "PENDING_BUILD",
            "datapointsCollectionPercentage": 0.0
        },
        {
            "securityProfileName": "MySecuirtyProfileName",
            "behaviorName": "Authorization_failures_ML_behavior",
            "modelStatus": "PENDING_BUILD",
            "datapointsCollectionPercentage": 0.0
        },
        {
            "securityProfileName": "MySecuirtyProfileName",
            "behaviorName": "Message_size_ML_behavior",
            "modelStatus": "PENDING_BUILD",
            "datapointsCollectionPercentage": 0.0
        },
        {
            "securityProfileName": "MySecuirtyProfileName",
            "behaviorName": "Connection_attempts_ML_behavior",
            "modelStatus": "PENDING_BUILD",
            "datapointsCollectionPercentage": 0.0
        },
        {
            "securityProfileName": "MySPNoALerts",
            "behaviorName": "Disconnects_ML_behavior",
            "modelStatus": "PENDING_BUILD",
            "datapointsCollectionPercentage": 0.0
        }
    ]
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南》*中的 [GetBehaviorModelTrainingSummaries （检测命令）](https://docs.aws.amazon.com/iot/latest/developerguide/detect-commands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetBehaviorModelTrainingSummaries](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-behavior-model-training-summaries.html)*中的。

### `get-cardinality`
<a name="iot_GetCardinality_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-cardinality`。

**AWS CLI**  
**返回与查询匹配的唯一值的近似计数**  
您可以使用以下设置脚本来创建 10 个事物，代表 10 个温度传感器。每个新事物有 3 个属性。  

```
# Bash script. If in other shells, type `bash` before running
Temperatures=(70 71 72 73 74 75 47 97 98 99)
Racks=(Rack1 Rack1 Rack2 Rack2 Rack3 Rack4 Rack5 Rack6 Rack6 Rack6)
IsNormal=(true true true true true true false false false false)
for ((i=0; i<10 ; i++))
do
  thing=$(aws iot create-thing --thing-name "TempSensor$i" --attribute-payload attributes="{temperature=${Temperatures[i]},rackId=${Racks[i]},stateNormal=${IsNormal[i]}}")
  aws iot describe-thing --thing-name "TempSensor$i"
done
```
设置脚本的输出示例：  

```
{
    "version": 1,
    "thingName": "TempSensor0",
    "defaultClientId": "TempSensor0",
    "attributes": {
        "rackId": "Rack1",
        "stateNormal": "true",
        "temperature": "70"
    },
    "thingArn": "arn:aws:iot:us-east-1:123456789012:thing/TempSensor0",
    "thingId": "example1-90ab-cdef-fedc-ba987example"
}
```
以下 `get-cardinality` 示例查询由设置脚本创建的 10 个传感器，并返回具有报告异常温度值的温度传感器的机架数量。如果温度值低于 60 或高于 80，则温度传感器处于异常状态。  

```
aws iot get-cardinality \
    --aggregation-field "attributes.rackId" \
    --query-string "thingName:TempSensor* AND attributes.stateNormal:false"
```
输出：  

```
{
    "cardinality": 2
}
```
*有关更多信息，请参阅《物联网开发者指南》中的查询聚合数据< https://docs.aws.amazon.com/iot/ latest/developerguide/index-aggregate.html>。AWS *  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetCardinality](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-cardinality.html)*中的。

### `get-effective-policies`
<a name="iot_GetEffectivePolicies_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-effective-policies`。

**AWS CLI**  
**列出影响事物的策略**  
以下 `get-effective-policies` 示例列出影响指定事物的策略，包括附加到其所属任何事物组的策略。  

```
aws iot get-effective-policies \
    --thing-name TemperatureSensor-001 \
    --principal arn:aws:iot:us-west-2:123456789012:cert/488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142
```
输出：  

```
{
    "effectivePolicies": [
        {
            "policyName": "TemperatureSensorPolicy",
            "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/TemperatureSensorPolicy",
            "policyDocument": "{
                \"Version\": \"2012-10-17\",
                \"Statement\": [
                    {
                        \"Effect\": \"Allow\",
                        \"Action\": [
                            \"iot:Publish\",
                            \"iot:Receive\"
                        ],
                        \"Resource\": [
                            \"arn:aws:iot:us-west-2:123456789012:topic/topic_1\",
                            \"arn:aws:iot:us-west-2:123456789012:topic/topic_2\"
                        ]
                    },
                    {
                        \"Effect\": \"Allow\",
                        \"Action\": [
                            \"iot:Subscribe\"
                        ],
                        \"Resource\": [
                            \"arn:aws:iot:us-west-2:123456789012:topicfilter/topic_1\",
                            \"arn:aws:iot:us-west-2:123456789012:topicfilter/topic_2\"
                        ]
                    },
                    {
                        \"Effect\": \"Allow\",
                        \"Action\": [
                            \"iot:Connect\"
                        ],
                        \"Resource\": [
                            \"arn:aws:iot:us-west-2:123456789012:client/basicPubSub\"
                        ]
                    }
                ]
            }"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[获取事物的有效策略](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html#group-get-effective-policies)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetEffectivePolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-effective-policies.html)*中的。

### `get-indexing-configuration`
<a name="iot_GetIndexingConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-indexing-configuration`。

**AWS CLI**  
**获取事物索引配置**  
以下`get-indexing-configuration`示例获取 AWS 物联网队列索引的当前配置数据。  

```
aws iot get-indexing-configuration
```
输出：  

```
{
    "thingIndexingConfiguration": {
        "thingIndexingMode": "OFF",
        "thingConnectivityIndexingMode": "OFF"
    },
    "thingGroupIndexingConfiguration": {
        "thingGroupIndexingMode": "OFF"
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[管理事物索引](https://docs.aws.amazon.com/iot/latest/developerguide/managing-index.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetIndexingConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-indexing-configuration.html)*中的。

### `get-job-document`
<a name="iot_GetJobDocument_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-job-document`。

**AWS CLI**  
**检索作业的文档**  
以下 `get-job-document` 示例显示 ID 为 `example-job-01` 的作业的文档的详细信息。  

```
aws iot get-job-document \
    --job-id "example-job-01"
```
输出：  

```
{
    "document": "\n{\n    \"operation\":\"customJob\",\n    \"otherInfo\":\"someValue\"\n}\n"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetJobDocument](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-job-document.html)*中的。

### `get-logging-options`
<a name="iot_GetLoggingOptions_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-logging-options`。

**AWS CLI**  
**获取日志选项**  
以下`get-logging-options`示例获取您 AWS 账户的当前日志选项。  

```
aws iot get-logging-options
```
输出：  

```
{
    "roleArn": "arn:aws:iam::123456789012:role/service-role/iotLoggingRole",
    "logLevel": "ERROR"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的相关标题。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetLoggingOptions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-logging-options.html)*中的。

### `get-ota-update`
<a name="iot_GetOtaUpdate_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-ota-update`。

**AWS CLI**  
**检索有关 OTA 更新的信息**  
以下 `get-ota-update` 示例显示有关指定 OTA 更新的详细信息。  

```
aws iot get-ota-update \
    --ota-update-id ota12345
```
输出：  

```
{
    "otaUpdateInfo": {
        "otaUpdateId": "ota12345",
        "otaUpdateArn": "arn:aws:iot:us-west-2:123456789012:otaupdate/itsaupdate",
        "creationDate": 1557863215.995,
        "lastModifiedDate": 1557863215.995,
        "description": "A critical update needed right away.",
        "targets": [
           "device1",
           "device2",
           "device3",
           "device4"
        ],
        "targetSelection": "SNAPSHOT",
        "protocols": ["HTTP"],
        "awsJobExecutionsRolloutConfig": {
           "maximumPerMinute": 10
        },
        "otaUpdateFiles": [
            {
                "fileName": "firmware.bin",
                "fileLocation": {
                    "stream": {
                        "streamId": "004",
                        "fileId":123
                    }
                },
                "codeSigning": {
                    "awsSignerJobId": "48c67f3c-63bb-4f92-a98a-4ee0fbc2bef6"
                }
            }
        ],
        "roleArn": "arn:aws:iam:123456789012:role/service-role/my_ota_role"
        "otaUpdateStatus": "CREATE_COMPLETE",
        "awsIotJobId": "job54321",
        "awsIotJobArn": "arn:aws:iot:us-west-2:123456789012:job/job54321",
        "errorInfo": {
        }
    }
}
```
有关更多信息，请参阅 *AWS IoT API 参考OTAUpdate*中的[获取](https://docs.aws.amazon.com/iot/latest/apireference/API_GetOTAUpdate.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetOtaUpdate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-ota-update.html)*中的。

### `get-percentiles`
<a name="iot_GetPercentiles_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-percentiles`。

**AWS CLI**  
**将与查询匹配的聚合值分组为百分位数分组**  
您可以使用以下设置脚本来创建 10 个事物，代表 10 个温度传感器。每个新事物都有 1 个属性。  

```
# Bash script. If in other shells, type `bash` before running
Temperatures=(70 71 72 73 74 75 47 97 98 99)
for ((i=0; i<10 ; i++))
do
    thing=$(aws iot create-thing --thing-name "TempSensor$i" --attribute-payload attributes="{temperature=${Temperatures[i]}}")
    aws iot describe-thing --thing-name "TempSensor$i"
done
```
设置脚本的输出示例：  

```
{
    "version": 1,
    "thingName": "TempSensor0",
    "defaultClientId": "TempSensor0",
    "attributes": {
        "temperature": "70"
    },
    "thingArn": "arn:aws:iot:us-east-1:123456789012:thing/TempSensor0",
    "thingId": "example1-90ab-cdef-fedc-ba987example"
}
```
以下 `get-percentiles` 示例查询由设置脚本创建的 10 个传感器，并为指定的每个百分位数组返回一个值。百分位数组“10”包含的聚合字段值发生在大约 10% 的与查询匹配的值中。在以下输出中，\$1"percent": 10.0, "value": 67.7\$1 表示大约 10.0% 的温度值低于 67.7。  

```
aws iot get-percentiles \
    --aggregation-field "attributes.temperature" \
    --query-string "thingName:TempSensor*" \
    --percents 10 25 50 75 90
```
输出：  

```
{
    "percentiles": [
        {
            "percent": 10.0,
            "value": 67.7
        },
        {
            "percent": 25.0,
            "value": 71.25
        },
        {
            "percent": 50.0,
            "value": 73.5
        },
        {
            "percent": 75.0,
            "value": 91.5
        },
        {
            "percent": 90.0,
            "value": 98.1
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的[查询聚合数据](https://docs.aws.amazon.com/iot/latest/developerguide/index-aggregate.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetPercentiles](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-percentiles.html)*中的。

### `get-policy-version`
<a name="iot_GetPolicyVersion_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-policy-version`。

**AWS CLI**  
**获取有关策略特定版本的信息**  
以下 `get-policy-version` 示例获取指定策略的第一个版本的信息。  

```
aws iot get-policy \
    --policy-name UpdateDeviceCertPolicy
    --policy-version-id "1"
```
输出：  

```
{
    "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/UpdateDeviceCertPolicy",
    "policyName": "UpdateDeviceCertPolicy",
    "policyDocument": "{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Effect\": \"Allow\", \"Action\":  \"iot:UpdateCertificate\", \"Resource\": \"*\" } ] }",
    "policyVersionId": "1",
    "isDefaultVersion": false,
    "creationDate": 1559925941.924,
    "lastModifiedDate": 1559926175.458,
    "generationId": "5066f1b6712ce9d2a1e56399771649a272d6a921762fead080e24fe52f24e042"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的 [AWS IoT 策略](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetPolicyVersion](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-policy-version.html)*中的。

### `get-policy`
<a name="iot_GetPolicy_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-policy`。

**AWS CLI**  
**获取有关策略默认版本的信息**  
以下 `get-policy` 示例检索指定策略的默认版本的信息。  

```
aws iot get-policy \
    --policy-name UpdateDeviceCertPolicy
```
输出：  

```
{
    "policyName": "UpdateDeviceCertPolicy",
    "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/UpdateDeviceCertPolicy",
    "policyDocument": "{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Effect\": \"Allow\", \"Action\":  \"iot:UpdateCertificate\", \"Resource\": \"*\" } ] }",
    "defaultVersionId": "2",
    "creationDate": 1559925941.924,
    "lastModifiedDate": 1559925941.924,
    "generationId": "5066f1b6712ce9d2a1e56399771649a272d6a921762fead080e24fe52f24e042"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的 [AWS IoT 策略](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-policy.html)*中的。

### `get-registration-code`
<a name="iot_GetRegistrationCode_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-registration-code`。

**AWS CLI**  
**获取您的 AWS 账户专用注册码**  
以下`get-registration-code`示例检索您的 AWS 账户专用注册码。  

```
aws iot get-registration-code
```
输出：  

```
{
    "registrationCode": "15c51ae5e36ba59ba77042df1115862076bea4bd15841c838fcb68d5010a614c"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[使用您自己的证书](https://docs.aws.amazon.com/iot/latest/developerguide/device-certs-your-own.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetRegistrationCode](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-registration-code.html)*中的。

### `get-statistics`
<a name="iot_GetStatistics_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-statistics`。

**AWS CLI**  
**在设备索引中搜索聚合数据**  
以下 `get-statistics` 示例返回设备影子中的事物数量，这些事物的名为 `connectivity.connected` 的属性设置为 `false`（即未连接的设备数量）。  

```
aws iot get-statistics \
    --index-name AWS_Things \
    --query-string "connectivity.connected:false"
```
输出：  

```
{
    "statistics": {
        "count": 6
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[获取有关您的设备实例集的统计信息](https://docs.aws.amazon.com/iot/latest/developerguide/index-aggregate.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetStatistics](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-statistics.html)*中的。

### `get-topic-rule-destination`
<a name="iot_GetTopicRuleDestination_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-topic-rule-destination`。

**AWS CLI**  
**获取主题规则目标**  
以下 `get-topic-rule-destination` 示例获取某个主题规则目标的信息。  

```
aws iot get-topic-rule-destination \
    --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE"
```
输出：  

```
{
    "topicRuleDestination": {
        "arn": "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
        "status": "DISABLED",
        "httpUrlProperties": {
            "confirmationUrl": "https://example.com"
        }
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[使用主题规则目标](https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetTopicRuleDestination](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-topic-rule-destination.html)*中的。

### `get-topic-rule`
<a name="iot_GetTopicRule_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-topic-rule`。

**AWS CLI**  
**获取有关规则的信息**  
以下 `get-topic-rule` 示例获取有关指定规则的信息。  

```
aws iot get-topic-rule \
    --rule-name MyRPiLowMoistureAlertRule
```
输出：  

```
{
    "ruleArn": "arn:aws:iot:us-west-2:123456789012:rule/MyRPiLowMoistureAlertRule",
    "rule": {
        "ruleName": "MyRPiLowMoistureAlertRule",
        "sql": "SELECT * FROM '$aws/things/MyRPi/shadow/update/accepted' WHERE state.reported.moisture = 'low'\n                    ",
        "description": "Sends an alert whenever soil moisture level readings are too low.",
        "createdAt": 1558624363.0,
        "actions": [
            {
                "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:MyRPiLowMoistureTopic",
                    "roleArn": "arn:aws:iam::123456789012:role/service-role/MyRPiLowMoistureTopicRole",
                    "messageFormat": "RAW"
                }
            }
        ],
        "ruleDisabled": false,
        "awsIotSqlVersion": "2016-03-23"
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[查看您的规则](https://docs.aws.amazon.com/iot/latest/developerguide/iot-managae-rule.html#iot-view-rules)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetTopicRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-topic-rule.html)*中的。

### `get-v2-logging-options`
<a name="iot_GetV2LoggingOptions_cli_2_topic"></a>

以下代码示例演示了如何使用 `get-v2-logging-options`。

**AWS CLI**  
**列出当前的日志选项**  
以下`get-v2-logging-options`示例列出了 I AWS oT 的当前日志选项。  

```
aws iot get-v2-logging-options
```
输出：  

```
{
    "roleArn": "arn:aws:iam::094249569039:role/service-role/iotLoggingRole",
    "defaultLogLevel": "WARN",
    "disableAllLogs": false
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的相关标题。**  
+  有关 API 的详细信息，请参阅《*AWS CLI 命令*参考LoggingOptions》中的 [GetV2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/get-v2-logging-options.html)。

### `list-active-violations`
<a name="iot_ListActiveViolations_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-active-violations`。

**AWS CLI**  
**列出活跃违规项**  
以下 `list-active-violations` 示例列出指定安全配置文件的所有违规项。  

```
aws iot list-active-violations \
    --security-profile-name Testprofile
```
输出：  

```
{
    "activeViolations": [
        {
            "violationId": "174db59167fa474c80a652ad1583fd44",
            "thingName": "iotconsole-1560269126751-1",
            "securityProfileName": "Testprofile",
            "behavior": {
                "name": "Authorization",
                "metric": "aws:num-authorization-failures",
                "criteria": {
                    "comparisonOperator": "greater-than",
                    "value": {
                        "count": 10
                    },
                    "durationSeconds": 300,
                    "consecutiveDatapointsToAlarm": 1,
                    "consecutiveDatapointsToClear": 1
                }
            },
            "lastViolationValue": {
                "count": 0
            },
            "lastViolationTime": 1560293700.0,
            "violationStartTime": 1560279000.0
        },
        {
            "violationId": "c8a9466a093d3b7b35cd44ca58bdbeab",
            "thingName": "TvnQoEoU",
            "securityProfileName": "Testprofile",
            "behavior": {
                "name": "CellularBandwidth",
                "metric": "aws:message-byte-size",
                "criteria": {
                    "comparisonOperator": "greater-than",
                    "value": {
                        "count": 128
                    },
                    "consecutiveDatapointsToAlarm": 1,
                    "consecutiveDatapointsToClear": 1
                }
            },
            "lastViolationValue": {
                "count": 110
            },
            "lastViolationTime": 1560369000.0,
            "violationStartTime": 1560276600.0
        },
        {
            "violationId": "74aa393adea02e6648f3ac362beed55e",
            "thingName": "iotconsole-1560269232412-2",
            "securityProfileName": "Testprofile",
            "behavior": {
                "name": "Authorization",
                "metric": "aws:num-authorization-failures",
                "criteria": {
                    "comparisonOperator": "greater-than",
                    "value": {
                        "count": 10
                    },
                    "durationSeconds": 300,
                    "consecutiveDatapointsToAlarm": 1,
                    "consecutiveDatapointsToClear": 1
                }
            },
            "lastViolationValue": {
                "count": 0
            },
            "lastViolationTime": 1560276600.0,
            "violationStartTime": 1560276600.0
        },
        {
            "violationId": "1e6ab5f7cf39a1466fcd154e1377e406",
            "thingName": "TvnQoEoU",
            "securityProfileName": "Testprofile",
            "behavior": {
                "name": "Authorization",
                "metric": "aws:num-authorization-failures",
                "criteria": {
                    "comparisonOperator": "greater-than",
                    "value": {
                        "count": 10
                    },
                    "durationSeconds": 300,
                    "consecutiveDatapointsToAlarm": 1,
                    "consecutiveDatapointsToClear": 1
                }
            },
            "lastViolationValue": {
                "count": 0
            },
            "lastViolationTime": 1560369000.0,
            "violationStartTime": 1560276600.0
        }
    ]
}
```
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListActiveViolations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-active-violations.html)*中的。

### `list-attached-policies`
<a name="iot_ListAttachedPolicies_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-attached-policies`。

**AWS CLI**  
**示例 1：列出附加到组的策略**  
以下 `list-attached-policies` 示例列出附加到指定组的策略。  

```
aws iot list-attached-policies \
    --target "arn:aws:iot:us-west-2:123456789012:thinggroup/LightBulbs"
```
输出：  

```
{
    "policies": [
        {
            "policyName": "UpdateDeviceCertPolicy",
            "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/UpdateDeviceCertPolicy"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
**示例 2：列出附加到设备证书的策略**  
以下`list-attached-policies`示例列出了附加到设备证书的 AWS IoT 策略。证书通过其 ARN 来标识。  

```
aws iot list-attached-policies \
    --target arn:aws:iot:us-west-2:123456789012:cert/488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142
```
输出：  

```
{
    "policies": [
        {
            "policyName": "TemperatureSensorPolicy",
            "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/TemperatureSensorPolicy"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListAttachedPolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-attached-policies.html)*中的。

### `list-audit-findings`
<a name="iot_ListAuditFindings_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-audit-findings`。

**AWS CLI**  
**示例 1：列出审计的所有调查发现**  
以下`list-audit-findings`示例列出了具有指定任务 ID 的 I AWS oT Device Defender 审计的所有结果。  

```
aws iot list-audit-findings \
    --task-id a3aea009955e501a31b764abe1bebd3d
```
输出：  

```
{
    "findings": []
}
```
**示例 2：列出审计检查类型的调查发现**  
以下`list-audit-findings`示例显示了 2019 年 6 月 5 日至 2019 年 6 月 19 日期间进行的 AWS IoT Device Defender 审计的结果，其中设备共享设备证书。当您指定检查名称时，必须提供开始和结束时间。  

```
aws iot list-audit-findings \
    --check-name DEVICE_CERTIFICATE_SHARED_CHECK \
    --start-time 1559747125 \
    --end-time 1560962028
```
输出：  

```
{
    "findings": [
        {
            "taskId": "eeef61068b0eb03c456d746c5a26ee04",
            "checkName": "DEVICE_CERTIFICATE_SHARED_CHECK",
            "taskStartTime": 1560161017.172,
            "findingTime": 1560161017.592,
            "severity": "CRITICAL",
            "nonCompliantResource": {
                "resourceType": "DEVICE_CERTIFICATE",
                "resourceIdentifier": {
                    "deviceCertificateId": "b193ab7162c0fadca83246d24fa090300a1236fe58137e121b011804d8ac1d6b"
                }
            },
            "relatedResources": [
                {
                    "resourceType": "CLIENT_ID",
                    "resourceIdentifier": {
                        "clientId": "ZipxgAIl"
                    },
                    "additionalInfo": {
                        "CONNECTION_TIME": "1560086374068"
                    }
                },
                {
                    "resourceType": "CLIENT_ID",
                    "resourceIdentifier": {
                        "clientId": "ZipxgAIl"
                    },
                    "additionalInfo": {
                        "CONNECTION_TIME": "1560081552187",
                        "DISCONNECTION_TIME": "1560086371552"
                    }
                },
                {
                    "resourceType": "CLIENT_ID",
                    "resourceIdentifier": {
                        "clientId": "ZipxgAIl"
                    },
                    "additionalInfo": {
                        "CONNECTION_TIME": "1559289863631",
                        "DISCONNECTION_TIME": "1560081532716"
                    }
                }
            ],
            "reasonForNonCompliance": "Certificate shared by one or more devices.",
            "reasonForNonComplianceCode": "CERTIFICATE_SHARED_BY_MULTIPLE_DEVICES"
        },
        {
            "taskId": "bade6b5efd2e1b1569822f6021b39cf5",
            "checkName": "DEVICE_CERTIFICATE_SHARED_CHECK",
            "taskStartTime": 1559988217.27,
            "findingTime": 1559988217.655,
            "severity": "CRITICAL",
            "nonCompliantResource": {
                "resourceType": "DEVICE_CERTIFICATE",
                "resourceIdentifier": {
                    "deviceCertificateId": "b193ab7162c0fadca83246d24fa090300a1236fe58137e121b011804d8ac1d6b"
                }
            },
            "relatedResources": [
                {
                    "resourceType": "CLIENT_ID",
                    "resourceIdentifier": {
                        "clientId": "xShGENLW"
                    },
                    "additionalInfo": {
                        "CONNECTION_TIME": "1559972350825"
                    }
                },
                {
                    "resourceType": "CLIENT_ID",
                    "resourceIdentifier": {
                        "clientId": "xShGENLW"
                    },
                    "additionalInfo": {
                        "CONNECTION_TIME": "1559255062002",
                        "DISCONNECTION_TIME": "1559972350616"
                    }
                }
            ],
            "reasonForNonCompliance": "Certificate shared by one or more devices.",
            "reasonForNonComplianceCode": "CERTIFICATE_SHARED_BY_MULTIPLE_DEVICES"
        },
        {
            "taskId": "c23f6233ba2d35879c4bb2810fb5ffd6",
            "checkName": "DEVICE_CERTIFICATE_SHARED_CHECK",
            "taskStartTime": 1559901817.31,
            "findingTime": 1559901817.767,
            "severity": "CRITICAL",
            "nonCompliantResource": {
                "resourceType": "DEVICE_CERTIFICATE",
                "resourceIdentifier": {
                    "deviceCertificateId": "b193ab7162c0fadca83246d24fa090300a1236fe58137e121b011804d8ac1d6b"
                }
            },
            "relatedResources": [
                {
                    "resourceType": "CLIENT_ID",
                    "resourceIdentifier": {
                        "clientId": "TvnQoEoU"
                    },
                    "additionalInfo": {
                        "CONNECTION_TIME": "1559826729768"
                    }
                },
                {
                    "resourceType": "CLIENT_ID",
                    "resourceIdentifier": {
                        "clientId": "TvnQoEoU"
                    },
                    "additionalInfo": {
                        "CONNECTION_TIME": "1559345920964",
                        "DISCONNECTION_TIME": "1559826728402"
                    }
                }
            ],
            "reasonForNonCompliance": "Certificate shared by one or more devices.",
            "reasonForNonComplianceCode": "CERTIFICATE_SHARED_BY_MULTIPLE_DEVICES"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListAuditFindings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-audit-findings.html)*中的。

### `list-audit-mitigation-actions-executions`
<a name="iot_ListAuditMitigationActionsExecutions_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-audit-mitigation-actions-executions`。

**AWS CLI**  
**列出审计缓解操作执行的详细信息**  
审计缓解措施任务对 AWS IoT Device Defender 审计中的一个或多个发现应用缓解措施。以下 `list-audit-mitigation-actions-executions` 示例列出具有指定 `taskId` 的缓解操作任务以及指定调查发现的详细信息。  

```
aws iot list-audit-mitigation-actions-executions \
    --task-id myActionsTaskId \
    --finding-id 0edbaaec-2fe1-4cf5-abc9-d4c3e51f7464
```
输出：  

```
{
    "actionsExecutions": [
        {
            "taskId": "myActionsTaskId",
            "findingId": "0edbaaec-2fe1-4cf5-abc9-d4c3e51f7464",
            "actionName": "ResetPolicyVersionAction",
            "actionId": "1ea0b415-bef1-4a01-bd13-72fb63c59afb",
            "status": "COMPLETED",
            "startTime": "2019-12-10T15:19:13.279000-08:00",
            "endTime": "2019-12-10T15:19:13.337000-08:00"
        }
    ]
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [ListAuditMitigationActionsExecutions （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-ListAuditMitigationActionsExecutions)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListAuditMitigationActionsExecutions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-audit-mitigation-actions-executions.html)*中的。

### `list-audit-mitigation-actions-tasks`
<a name="iot_ListAuditMitigationActionsTasks_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-audit-mitigation-actions-tasks`。

**AWS CLI**  
**列出审计缓解操作任务**  
以下 `list-audit-mitigation-actions-tasks` 示例列出应用于指定时间段内的调查发现的缓解操作。  

```
aws iot list-audit-mitigation-actions-tasks \
    --start-time 1594157400 \
    --end-time 1594157430
```
输出：  

```
{
    "tasks": [
        {
                "taskId": "0062f2d6-3999-488f-88c7-bef005414103",
                "startTime": "2020-07-07T14:30:15.172000-07:00",
            "taskStatus": "COMPLETED"
        }
    ]
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [ListAuditMitigationActionsTasks （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-ListAuditMitigationActionsTasks)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListAuditMitigationActionsTasks](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-audit-mitigation-actions-tasks.html)*中的。

### `list-audit-suppressions`
<a name="iot_ListAuditSuppressions_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-audit-suppressions`。

**AWS CLI**  
**列出所有审计调查发现抑制**  
以下 `list-audit-suppressions` 示例列出所有活跃的审计调查发现抑制。  

```
aws iot list-audit-suppressions
```
输出：  

```
{
    "suppressions": [
        {
        "checkName": "DEVICE_CERTIFICATE_EXPIRING_CHECK",
            "resourceIdentifier": {
                "deviceCertificateId": "c7691e<shortened>"
            },
        "expirationDate": 1597881600.0,
        "suppressIndefinitely": false
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[审计调查发现抑制](https://docs.aws.amazon.com/iot/latest/developerguide/audit-finding-suppressions.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListAuditSuppressions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-audit-suppressions.html)*中的。

### `list-audit-tasks`
<a name="iot_ListAuditTasks_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-audit-tasks`。

**AWS CLI**  
**列出审计的所有调查发现**  
以下 `list-audit-tasks` 示例列出在 2019 年 6 月 5 日至 2019 年 6 月 12 日之间运行的审计任务。  

```
aws iot list-audit-tasks \
    --start-time 1559747125 \
    --end-time 1560357228
```
输出：  

```
{
    "tasks": [
        {
            "taskId": "a3aea009955e501a31b764abe1bebd3d",
            "taskStatus": "COMPLETED",
            "taskType": "ON_DEMAND_AUDIT_TASK"
        },
        {
            "taskId": "f76b4b5102b632cd9ae38a279c266da1",
            "taskStatus": "COMPLETED",
            "taskType": "SCHEDULED_AUDIT_TASK"
        },
        {
            "taskId": "51d9967d9f9ff4d26529505f6d2c444a",
            "taskStatus": "COMPLETED",
            "taskType": "SCHEDULED_AUDIT_TASK"
        },
        {
            "taskId": "eeef61068b0eb03c456d746c5a26ee04",
            "taskStatus": "COMPLETED",
            "taskType": "SCHEDULED_AUDIT_TASK"
        },
        {
            "taskId": "041c49557b7c7b04c079a49514b55589",
            "taskStatus": "COMPLETED",
            "taskType": "SCHEDULED_AUDIT_TASK"
        },
        {
            "taskId": "82c7f2afac1562d18a4560be73998acc",
            "taskStatus": "COMPLETED",
            "taskType": "SCHEDULED_AUDIT_TASK"
        },
        {
            "taskId": "bade6b5efd2e1b1569822f6021b39cf5",
            "taskStatus": "COMPLETED",
            "taskType": "SCHEDULED_AUDIT_TASK"
        },
        {
            "taskId": "c23f6233ba2d35879c4bb2810fb5ffd6",
            "taskStatus": "COMPLETED",
            "taskType": "SCHEDULED_AUDIT_TASK"
        },
        {
            "taskId": "ac9086b7222a2f5e2e17bb6fd30b3aeb",
            "taskStatus": "COMPLETED",
            "taskType": "SCHEDULED_AUDIT_TASK"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListAuditTasks](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-audit-tasks.html)*中的。

### `list-authorizers`
<a name="iot_ListAuthorizers_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-authorizers`。

**AWS CLI**  
**列出您的自定义授权方**  
以下`list-authorizers`示例列出了您 AWS 账户中的自定义授权方。  

```
aws iot list-authorizers
```
输出：  

```
{
    "authorizers": [
        {
            "authorizerName": "CustomAuthorizer",
            "authorizerArn": "arn:aws:iot:us-west-2:123456789012:authorizer/CustomAuthorizer"
        },
        {
            "authorizerName": "CustomAuthorizer2",
            "authorizerArn": "arn:aws:iot:us-west-2:123456789012:authorizer/CustomAuthorizer2"
        },
        {
            "authorizerName": "CustomAuthorizer3",
            "authorizerArn": "arn:aws:iot:us-west-2:123456789012:authorizer/CustomAuthorizer3"
        }
    ]
}
```
有关更多信息，请参阅[ListAuthorizers](https://docs.aws.amazon.com/iot/latest/apireference/API_ListAuthorizers.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListAuthorizers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-authorizers.html)*中的。

### `list-billing-groups`
<a name="iot_ListBillingGroups_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-billing-groups`。

**AWS CLI**  
**列出您的 AWS 账户和地区的账单组**  
以下`list-billing-groups`示例列出了为您的 AWS 账户和 AWS 地区定义的所有账单组。  

```
aws iot list-billing-groups
```
输出：  

```
{
    "billingGroups": [
        {
            "groupName": "GroupOne",
            "groupArn": "arn:aws:iot:us-west-2:123456789012:billinggroup/GroupOne"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[账单组](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-billing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListBillingGroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-billing-groups.html)*中的。

### `list-ca-certificates`
<a name="iot_ListCaCertificates_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-ca-certificates`。

**AWS CLI**  
**列出在您的 AWS 账户中注册的 CA 证书**  
以下`list-ca-certificates`示例列出了在您的 AWS 账户中注册的 CA 证书。  

```
aws iot list-ca-certificates
```
输出：  

```
{
    "certificates": [
        {
            "certificateArn": "arn:aws:iot:us-west-2:123456789012:cacert/f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467",
            "certificateId": "f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467",
            "status": "INACTIVE",
            "creationDate": 1569365372.053
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[使用您自己的证书](https://docs.aws.amazon.com/iot/latest/developerguide/device-certs-your-own.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListCaCertificates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-ca-certificates.html)*中的。

### `list-certificates-by-ca`
<a name="iot_ListCertificatesByCa_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-certificates-by-ca`。

**AWS CLI**  
**列出所有使用 CA 证书签名的设备证书**  
以下`list-certificates-by-ca`示例列出了您 AWS 账户中使用指定 CA 证书签名的所有设备证书。  

```
aws iot list-certificates-by-ca \
    --ca-certificate-id f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467
```
输出：  

```
{
    "certificates": [
        {
            "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142",
            "certificateId": "488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142",
            "status": "ACTIVE",
            "creationDate": 1569363250.557
        }
    ]
}
```
有关更多信息，请参阅《*AWS 物联网 API 参考*》中的 [ListCertificatesByCA](https://docs.aws.amazon.com/iot/latest/apireference/API_ListCertificatesByCA.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListCertificatesByCa](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-certificates-by-ca.html)*中的。

### `list-certificates`
<a name="iot_ListCertificates_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-certificates`。

**AWS CLI**  
**示例 1：列出在您的 AWS 账户中注册的证书**  
以下 `list-certificates` 示例列出在您的账户中注册的所有证书。如果您的分页数超过默认限制值 25，则您可以使用此命令中的 `nextMarker` 响应值并将其提供给下一个命令来获取下一批结果。重复此操作，直到 `nextMarker` 返回时没有值。  

```
aws iot list-certificates
```
输出：  

```
{
    "certificates": [
        {
            "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/604c48437a57b7d5fc5d137c5be75011c6ee67c9a6943683a1acb4b1626bac36",
            "certificateId": "604c48437a57b7d5fc5d137c5be75011c6ee67c9a6943683a1acb4b1626bac36",
            "status": "ACTIVE",
            "creationDate": 1556810537.617
        },
        {
            "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/262a1ac8a7d8aa72f6e96e365480f7313aa9db74b8339ec65d34dc3074e1c31e",
            "certificateId": "262a1ac8a7d8aa72f6e96e365480f7313aa9db74b8339ec65d34dc3074e1c31e",
            "status": "ACTIVE",
            "creationDate": 1546447050.885
        },
        {
            "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/b193ab7162c0fadca83246d24fa090300a1236fe58137e121b011804d8ac1d6b",
            "certificateId": "b193ab7162c0fadca83246d24fa090300a1236fe58137e121b011804d8ac1d6b",
            "status": "ACTIVE",
            "creationDate": 1546292258.322
        },
        {
            "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/7aebeea3845d14a44ec80b06b8b78a89f3f8a706974b8b34d18f5adf0741db42",
            "certificateId": "7aebeea3845d14a44ec80b06b8b78a89f3f8a706974b8b34d18f5adf0741db42",
            "status": "ACTIVE",
            "creationDate": 1541457693.453
        },
        {
            "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/54458aa39ebb3eb39c91ffbbdcc3a6ca1c7c094d1644b889f735a6fc2cd9a7e3",
            "certificateId": "54458aa39ebb3eb39c91ffbbdcc3a6ca1c7c094d1644b889f735a6fc2cd9a7e3",
            "status": "ACTIVE",
            "creationDate": 1541113568.611
        },
        {
            "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/4f0ba725787aa94d67d2fca420eca022242532e8b3c58e7465c7778b443fd65e",
            "certificateId": "4f0ba725787aa94d67d2fca420eca022242532e8b3c58e7465c7778b443fd65e",
            "status": "ACTIVE",
            "creationDate": 1541022751.983
        }
    ]
}
```
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListCertificates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-certificates.html)*中的。

### `list-custom-metrics`
<a name="iot_ListCustomMetrics_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-custom-metrics`。

**AWS CLI**  
**列出您的自定义指标**  
以下 `list-custom-metrics` 示例列出您的所有自定义指标。  

```
aws iot list-custom-metrics \
    --region us-east-1
```
输出：  

```
{
    "metricNames": [
        "batteryPercentage"
    ]
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[自定义指标](https://docs.aws.amazon.com/iot/latest/developerguide/dd-detect-custom-metrics.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListCustomMetrics](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-custom-metrics.html)*中的。

### `list-dimensions`
<a name="iot_ListDimensions_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-dimensions`。

**AWS CLI**  
**列出您 AWS 账户的维度**  
以下`list-dimensions`示例列出了在您的 AWS 账户中定义的所有 AWS IoT Device Defender 维度。  

```
aws iot list-dimensions
```
输出：  

```
{
    "dimensionNames": [
        "TopicFilterForAuthMessages",
        "TopicFilterForActivityMessages"
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListDimensions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-dimensions.html)*中的。

### `list-domain-configurations`
<a name="iot_ListDomainConfigurations_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-domain-configurations`。

**AWS CLI**  
**列出域配置**  
以下`list-domain-configurations`示例列出了您 AWS 账户中具有指定服务类型的域配置。  

```
aws iot list-domain-configurations \
    --service-type "DATA"
```
输出：  

```
{
    "domainConfigurations":
    [
        {
            "domainConfigurationName": "additionalDataDomain",
            "domainConfigurationArn": "arn:aws:iot:us-west-2:123456789012:domainconfiguration/additionalDataDomain/dikMh",
            "serviceType": "DATA"
        },

        {
            "domainConfigurationName": "iot:Jobs",
            "domainConfigurationArn": "arn:aws:iot:us-west-2:123456789012:domainconfiguration/iot:Jobs",
            "serviceType": "JOBS"
        },
        {
            "domainConfigurationName": "iot:Data-ATS",
            "domainConfigurationArn": "arn:aws:iot:us-west-2:123456789012:domainconfiguration/iot:Data-ATS",
            "serviceType": "DATA"
        },
        {
            "domainConfigurationName": "iot:CredentialProvider",
            "domainConfigurationArn": "arn:aws:iot:us-west-2:123456789012:domainconfiguration/iot:CredentialProvider",
            "serviceType": "CREDENTIAL_PROVIDER"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[可配置的端点](https://docs.aws.amazon.com/iot/latest/developerguide/iot-custom-endpoints-configurable-aws.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListDomainConfigurations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-domain-configurations.html)*中的。

### `list-indices`
<a name="iot_ListIndices_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-indices`。

**AWS CLI**  
**列出已配置的搜索索引**  
以下`list-indices`示例列出了您 AWS 账户中所有已配置的搜索索引。如果您尚未启用事物索引，则可能没有任何索引。  

```
aws iot list-indices
```
输出：  

```
{
    "indexNames": [
        "AWS_Things"
    ]
}
```
有关更多信息，请参阅《AWS 物联网开发人员指南》**中的[管理事物索引](https://docs.aws.amazon.com/iot/latest/developerguide/managing-index.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListIndices](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-indices.html)*中的。

### `list-job-executions-for-job`
<a name="iot_ListJobExecutionsForJob_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-job-executions-for-job`。

**AWS CLI**  
**列出您 AWS 账户中的职位**  
以下`list-job-executions-for-job`示例列出了由 jobid 指定的您 AWS 账户中某项任务的所有任务执行情况。  

```
aws iot list-job-executions-for-job \
    --job-id my-ota-job
```
输出：  

```
{
     "executionSummaries": [
         {
             "thingArn": "arn:aws:iot:us-east-1:123456789012:thing/my_thing",
             "jobExecutionSummary": {
                 "status": "QUEUED",
                 "queuedAt": "2022-03-07T15:58:42.195000-08:00",
                 "lastUpdatedAt": "2022-03-07T15:58:42.195000-08:00",
                 "executionNumber": 1,
                 "retryAttempt": 0
             }
         }
     ]
 }
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListJobExecutionsForJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-job-executions-for-job.html)*中的。

### `list-job-executions-for-thing`
<a name="iot_ListJobExecutionsForThing_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-job-executions-for-thing`。

**AWS CLI**  
**列出为某个事物执行的作业**  
以下 `list-job-executions-for-thing` 示例列出为名为 `MyRaspberryPi` 的事物执行的所有作业。  

```
aws iot list-job-executions-for-thing \
    --thing-name "MyRaspberryPi"
```
输出：  

```
{
    "executionSummaries": [
        {
            "jobId": "example-job-01",
            "jobExecutionSummary": {
                "status": "QUEUED",
                "queuedAt": 1560787023.636,
                "lastUpdatedAt": 1560787023.636,
                "executionNumber": 1
            }
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListJobExecutionsForThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-job-executions-for-thing.html)*中的。

### `list-jobs`
<a name="iot_ListJobs_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-jobs`。

**AWS CLI**  
**列出您 AWS 账户中的职位**  
以下`list-jobs`示例列出了您 AWS 账户中的所有任务，并按任务状态排序。  

```
aws iot list-jobs
```
输出：  

```
{
    "jobs": [
        {
            "jobArn": "arn:aws:iot:us-west-2:123456789012:job/example-job-01",
            "jobId": "example-job-01",
            "targetSelection": "SNAPSHOT",
            "status": "IN_PROGRESS",
            "createdAt": 1560787022.733,
            "lastUpdatedAt": 1560787026.294
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListJobs](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-jobs.html)*中的。

### `list-mitigation-actions`
<a name="iot_ListMitigationActions_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-mitigation-actions`。

**AWS CLI**  
**列出所有已定义的缓解操作**  
以下`list-mitigation-actions`示例列出了针对您的 AWS 账户和地区定义的所有缓解措施。对于每个操作，都会列出名称、ARN 和创建日期。  

```
aws iot list-mitigation-actions
```
输出：  

```
{
    "actionIdentifiers": [
        {
            "actionName": "DeactivateCACertAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/DeactivateCACertAction",
            "creationDate": "2019-12-10T11:12:47.574000-08:00"
        },
        {
            "actionName": "ResetPolicyVersionAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/ResetPolicyVersionAction",
            "creationDate": "2019-12-10T11:11:48.920000-08:00"
        },
        {
            "actionName": "PublishFindingToSNSAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/PublishFindingToSNSAction",
            "creationDate": "2019-12-10T11:10:49.546000-08:00"
        },
        {
            "actionName": "AddThingsToQuarantineGroupAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/AddThingsToQuarantineGroupAction",
            "creationDate": "2019-12-10T11:09:35.999000-08:00"
        },
        {
            "actionName": "UpdateDeviceCertAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/UpdateDeviceCertAction",
            "creationDate": "2019-12-10T11:08:44.263000-08:00"
        },
        {
            "actionName": "SampleMitigationAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/SampleMitigationAction",
            "creationDate": "2019-12-10T11:03:41.840000-08:00"
        }
    ]
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [ListMitigationActions （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-ListMitigationActions)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListMitigationActions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-mitigation-actions.html)*中的。

### `list-mitigations-actions`
<a name="iot_ListMitigationsActions_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-mitigations-actions`。

**AWS CLI**  
**列出所有已定义的缓解操作**  
以下`list-mitigations-actions`示例列出了针对您的 AWS 账户和地区定义的所有缓解措施。对于每个操作，都会列出名称、ARN 和创建日期。  

```
aws iot list-mitigation-actions
```
输出：  

```
{
    "actionIdentifiers": [
        {
            "actionName": "DeactivateCACertAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/DeactivateCACertAction",
            "creationDate": "2019-12-10T11:12:47.574000-08:00"
        },
        {
            "actionName": "ResetPolicyVersionAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/ResetPolicyVersionAction",
            "creationDate": "2019-12-10T11:11:48.920000-08:00"
        },
        {
            "actionName": "PublishFindingToSNSAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/PublishFindingToSNSAction",
            "creationDate": "2019-12-10T11:10:49.546000-08:00"
        },
        {
            "actionName": "AddThingsToQuarantineGroupAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/AddThingsToQuarantineGroupAction",
            "creationDate": "2019-12-10T11:09:35.999000-08:00"
        },
        {
            "actionName": "UpdateDeviceCertAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/UpdateDeviceCertAction",
            "creationDate": "2019-12-10T11:08:44.263000-08:00"
        },
        {
            "actionName": "SampleMitigationAction",
            "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/SampleMitigationAction",
            "creationDate": "2019-12-10T11:03:41.840000-08:00"
        }
    ]
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [ListMitigationActions （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-ListMitigationActions)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListMitigationsActions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-mitigations-actions.html)*中的。

### `list-ota-updates`
<a name="iot_ListOtaUpdates_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-ota-updates`。

**AWS CLI**  
**列出账户的 OTA 更新**  
以下 `list-ota-updates` 示例列出可用的 OTA 更新。  

```
aws iot list-ota-updates
```
输出：  

```
{
    "otaUpdates": [
        {
            "otaUpdateId": "itsaupdate",
            "otaUpdateArn": "arn:aws:iot:us-west-2:123456789012:otaupdate/itsaupdate",
            "creationDate": 1557863215.995
        }
    ]
}
```
有关更多信息，请参阅 *AWS IoT API 参考OTAUpdates*中的[列表](https://docs.aws.amazon.com/iot/latest/apireference/API_ListOTAUpdates.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListOtaUpdates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-ota-updates.html)*中的。

### `list-outgoing-certificates`
<a name="iot_ListOutgoingCertificates_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-outgoing-certificates`。

**AWS CLI**  
**列出正在转移到其他 AWS 账户的证书**  
以下`list-outgoing-certificates`示例列出了正在使用`transfer-certificate`命令转移到其他 AWS 账户的所有设备证书。  

```
aws iot list-outgoing-certificates
```
输出：  

```
{
    "outgoingCertificates": [
        {
            "certificateArn": "arn:aws:iot:us-west-2:030714055129:cert/488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142",
            "certificateId": "488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142",
            "transferredTo": "030714055129",
            "transferDate": 1569427780.441,
            "creationDate": 1569363250.557
        }
    ]
}
```
有关更多信息，请参阅[ListOutgoingCertificates](https://docs.aws.amazon.com/iot/latest/apireference/API_ListOutgoingCertificates.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListOutgoingCertificates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-outgoing-certificates.html)*中的。

### `list-policies`
<a name="iot_ListPolicies_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-policies`。

**AWS CLI**  
**列出您的 AWS 账户中定义的政策**  
以下`list-policies`示例列出了您的 AWS 账户中定义的所有政策。  

```
aws iot list-policies
```
输出：  

```
{
    "policies": [
        {
            "policyName": "UpdateDeviceCertPolicy",
            "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/UpdateDeviceCertPolicy"
        },
        {
            "policyName": "PlantIoTPolicy",
            "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/PlantIoTPolicy"
        },
        {
            "policyName": "MyPiGroup_Core-policy",
            "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/MyPiGroup_Core-policy"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的 [AWS IoT 策略](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListPolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-policies.html)*中的。

### `list-policy-versions`
<a name="iot_ListPolicyVersions_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-policy-versions`。

**AWS CLI**  
**示例 1：查看一个策略的所有版本**  
以下 `list-policy-versions` 示例列出指定策略的所有版本及其创建日期。  

```
aws iot list-policy-versions \
    --policy-name LightBulbPolicy
```
输出：  

```
{
    "policyVersions": [
        {
            "versionId": "2",
            "isDefaultVersion": true,
            "createDate": 1559925941.924
        },
        {
            "versionId": "1",
            "isDefaultVersion": false,
            "createDate": 1559925941.924
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南**》中的 [AWS IoT 策略](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListPolicyVersions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-policy-versions.html)*中的。

### `list-principal-things`
<a name="iot_ListPrincipalThings_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-principal-things`。

**AWS CLI**  
**列出附加到一个主体的事物**  
以下 `list-principal-things` 示例列出附加到由 ARN 指定的一个主体的事物。  

```
aws iot list-principal-things \
    --principal arn:aws:iot:us-west-2:123456789012:cert/2e1eb273792174ec2b9bf4e9b37e6c6c692345499506002a35159767055278e8
```
输出：  

```
{
    "things": [
        "DeskLamp",
        "TableLamp"
    ]
}
```
有关更多信息，请参阅[ListPrincipalThings](https://docs.aws.amazon.com/iot/latest/apireference/API_ListPrincipleThings.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListPrincipalThings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-principal-things.html)*中的。

### `list-provisioning-template-versions`
<a name="iot_ListProvisioningTemplateVersions_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-provisioning-template-versions`。

**AWS CLI**  
**列出预配模板版本**  
以下 `list-provisioning-template-versions` 示例列出指定预配模板的可用版本。  

```
aws iot list-provisioning-template-versions \
    --template-name "widget-template"
```
输出：  

```
{
    "versions": [
        {
            "versionId": 1,
            "creationDate": 1574800471.339,
            "isDefaultVersion": true
        },
        {
            "versionId": 2,
            "creationDate": 1574801192.317,
            "isDefaultVersion": false
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》中的 [AWS IoT 安全隧道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListProvisioningTemplateVersions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-provisioning-template-versions.html)*中的。

### `list-provisioning-templates`
<a name="iot_ListProvisioningTemplates_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-provisioning-templates`。

**AWS CLI**  
**列出预配模板**  
以下`list-provisioning-templates`示例列出了您 AWS 账户中的所有配置模板。  

```
aws iot list-provisioning-templates
```
输出：  

```
{
    "templates": [
        {
            "templateArn": "arn:aws:iot:us-east-1:123456789012:provisioningtemplate/widget-template",
            "templateName": "widget-template",
            "description": "A provisioning template for widgets",
            "creationDate": 1574800471.367,
            "lastModifiedDate": 1574801192.324,
            "enabled": false
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》中的 [AWS IoT 安全隧道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListProvisioningTemplates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-provisioning-templates.html)*中的。

### `list-role-aliases`
<a name="iot_ListRoleAliases_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-role-aliases`。

**AWS CLI**  
**列出您 AWS 账户中的 AWS IoT 角色别名**  
以下`list-role-aliases`示例列出了您 AWS 账户中的 AWS IoT 角色别名。  

```
aws iot list-role-aliases
```
输出：  

```
{
    "roleAliases": [
        "ResidentAlias",
        "ElectricianAlias"
    ]
}
```
有关更多信息，请参阅[ListRoleAliases](https://docs.aws.amazon.com/iot/latest/apireference/API_ListRoleAliases.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListRoleAliases](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-role-aliases.html)*中的。

### `list-scheduled-audits`
<a name="iot_ListScheduledAudits_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-scheduled-audits`。

**AWS CLI**  
**列出您 AWS 账户的预定审计**  
以下`list-scheduled-audits`示例列出了为您的 AWS 账户安排的所有审计。  

```
aws iot list-scheduled-audits
```
输出：  

```
{
    "scheduledAudits": [
        {
            "scheduledAuditName": "AWSIoTDeviceDefenderDailyAudit",
            "scheduledAuditArn": "arn:aws:iot:us-west-2:123456789012:scheduledaudit/AWSIoTDeviceDefenderDailyAudit",
            "frequency": "DAILY"
        },
        {
            "scheduledAuditName": "AWSDeviceDefenderWeeklyAudit",
            "scheduledAuditArn": "arn:aws:iot:us-west-2:123456789012:scheduledaudit/AWSDeviceDefenderWeeklyAudit",
            "frequency": "WEEKLY",
            "dayOfWeek": "SUN"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListScheduledAudits](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-scheduled-audits.html)*中的。

### `list-security-profiles-for-target`
<a name="iot_ListSecurityProfilesForTarget_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-security-profiles-for-target`。

**AWS CLI**  
**列出附加到某个目标的安全配置文件**  
以下`list-security-profiles-for-target`示例列出了附加到未注册设备的 AWS IoT Device Defender 安全配置文件。  

```
aws iot list-security-profiles-for-target  \
    --security-profile-target-arn "arn:aws:iot:us-west-2:123456789012:all/unregistered-things"
```
输出：  

```
{
    "securityProfileTargetMappings": [
        {
            "securityProfileIdentifier": {
                "name": "Testprofile",
                "arn": "arn:aws:iot:us-west-2:123456789012:securityprofile/Testprofile"
            },
            "target": {
                "arn": "arn:aws:iot:us-west-2:123456789012:all/unregistered-things"
            }
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListSecurityProfilesForTarget](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-security-profiles-for-target.html)*中的。

### `list-security-profiles`
<a name="iot_ListSecurityProfiles_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-security-profiles`。

**AWS CLI**  
**列出您 AWS 账户的安全配置文件**  
以下`list-security-profiles`示例列出了在您的 AWS 账户中定义的所有 AWS IoT Device Defender 安全配置文件。  

```
aws iot list-security-profiles
```
输出：  

```
{
    "securityProfileIdentifiers": [
        {
            "name": "Testprofile",
            "arn": "arn:aws:iot:us-west-2:123456789012:securityprofile/Testprofile"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListSecurityProfiles](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-security-profiles.html)*中的。

### `list-streams`
<a name="iot_ListStreams_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-streams`。

**AWS CLI**  
**列出账户中的流**  
以下`list-streams`示例列出了您 AWS 账户中的所有直播。  

```
aws iot list-streams
```
输出：  

```
{
    "streams": [
        {
            "streamId": "stream12345",
            "streamArn": "arn:aws:iot:us-west-2:123456789012:stream/stream12345",
            "streamVersion": 1,
            "description": "This stream is used for Amazon FreeRTOS OTA Update 12345."
        },
        {
            "streamId": "stream54321",
            "streamArn": "arn:aws:iot:us-west-2:123456789012:stream/stream54321",
            "streamVersion": 1,
            "description": "This stream is used for Amazon FreeRTOS OTA Update 54321."
        }
    ]
}
```
有关更多信息，请参阅[ListStreams](https://docs.aws.amazon.com/iot/latest/apireference/API_ListStreams.html)《*AWS 物联网 API 参考*》。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListStreams](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-streams.html)*中的。

### `list-tags-for-resource`
<a name="iot_ListTagsForResource_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-tags-for-resource`。

**AWS CLI**  
**显示与资源关联的标签及其值**  
以下 `list-tags-for-resource` 示例显示与事物组 `LightBulbs` 关联的标签和值。  

```
aws iot list-tags-for-resource \
    --resource-arn "arn:aws:iot:us-west-2:094249569039:thinggroup/LightBulbs"
```
输出：  

```
{
    "tags": [
        {
            "Key": "Assembly",
            "Value": "Fact1NW"
        },
        {
            "Key": "MyTag",
            "Value": "777"
        }
    ]
}
```
有关更多信息，请参阅《[AWS 物联网*开发者指南》中的为物AWS 联网*资源添加标签](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-tags-for-resource.html)*中的。

### `list-targets-for-policy`
<a name="iot_ListTargetsForPolicy_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-targets-for-policy`。

**AWS CLI**  
**列出与 AWS IoT 策略关联的委托人**  
以下 `list-targets-for-policy` 示例列出附加了指定策略的设备证书。  

```
aws iot list-targets-for-policy \
    --policy-name UpdateDeviceCertPolicy
```
输出：  

```
{
    "targets": [
        "arn:aws:iot:us-west-2:123456789012:cert/488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142",
        "arn:aws:iot:us-west-2:123456789012:cert/d1eb269fb55a628552143c8f96eb3c258fcd5331ea113e766ba0c82bf225f0be"
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListTargetsForPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-targets-for-policy.html)*中的。

### `list-targets-for-security-profile`
<a name="iot_ListTargetsForSecurityProfile_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-targets-for-security-profile`。

**AWS CLI**  
**列出应用了安全配置文件的目标**  
以下`list-targets-for-security-profile`示例列出了应用名`PossibleIssue`为的 AWS IoT Device Defender 安全配置文件的目标。  

```
aws iot list-targets-for-security-profile \
    --security-profile-name Testprofile
```
输出：  

```
{
    "securityProfileTargets": [
        {
            "arn": "arn:aws:iot:us-west-2:123456789012:all/unregistered-things"
        },
        {
            "arn": "arn:aws:iot:us-west-2:123456789012:all/registered-things"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListTargetsForSecurityProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-targets-for-security-profile.html)*中的。

### `list-thing-groups-for-thing`
<a name="iot_ListThingGroupsForThing_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-thing-groups-for-thing`。

**AWS CLI**  
**列出事物所属的组**  
以下 `list-thing-groups-for-thing` 示例列出指定事物所属的组。  

```
aws iot list-thing-groups-for-thing \
    --thing-name MyLightBulb
```
输出：  

```
{
    "thingGroups": [
        {
            "groupName": "DeadBulbs",
            "groupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/DeadBulbs"
        },
        {
            "groupName": "LightBulbs",
            "groupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/LightBulbs"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListThingGroupsForThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-thing-groups-for-thing.html)*中的。

### `list-thing-groups`
<a name="iot_ListThingGroups_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-thing-groups`。

**AWS CLI**  
**列出您的 AWS 账户中定义的事物组**  
以下`describe-thing-group`示例列出了您的 AWS 账户中定义的所有事物组。  

```
aws iot list-thing-groups
```
输出：  

```
{
    "thingGroups": [
        {
            "groupName": "HalogenBulbs",
            "groupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/HalogenBulbs"
        },
        {
            "groupName": "LightBulbs",
            "groupArn": "arn:aws:iot:us-west-2:123456789012:thinggroup/LightBulbs"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListThingGroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-thing-groups.html)*中的。

### `list-thing-principals`
<a name="iot_ListThingPrincipals_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-thing-principals`。

**AWS CLI**  
**列出与事物关联的主体**  
以下 `list-thing-principals` 示例列出与指定事物关联的主体（X.509 证书、IAM 用户、组、角色、Amazon Cognito 身份或联合身份）。  

```
aws iot list-thing-principals \
    --thing-name MyRaspberryPi
```
输出：  

```
{
    "principals": [
        "arn:aws:iot:us-west-2:123456789012:cert/33475ac865079a5ffd5ecd44240640349293facc760642d7d8d5dbb6b4c86893"
    ]
}
```
有关更多信息，请参阅 *AWS IoT API 参考[ListThingPrincipals](https://docs.aws.amazon.com/iot/latest/apireference/API_ListThingPrincipals.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListThingPrincipals](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-thing-principals.html)*中的。

### `list-thing-types`
<a name="iot_ListThingTypes_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-thing-types`。

**AWS CLI**  
**列出已定义的事物类型**  
以下`list-thing-types`示例显示了您的 AWS 账户中定义的事物类型列表。  

```
aws iot list-thing-types
```
输出：  

```
{
    "thingTypes": [
        {
            "thingTypeName": "LightBulb",
            "thingTypeArn": "arn:aws:iot:us-west-2:123456789012:thingtype/LightBulb",
            "thingTypeProperties": {
                "thingTypeDescription": "light bulb type",
                "searchableAttributes": [
                    "model",
                    "wattage"
                ]
            },
            "thingTypeMetadata": {
            "deprecated": false,
            "creationDate": 1559772562.498
            }
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[事物类型](https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListThingTypes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-thing-types.html)*中的。

### `list-things-in-billing-group`
<a name="iot_ListThingsInBillingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-things-in-billing-group`。

**AWS CLI**  
**列出账单组中的事物**  
以下 `list-things-in-billing-group` 示例列出指定账单组中的事物。  

```
aws iot list-things-in-billing-group \
    --billing-group-name GroupOne
```
输出：  

```
{
    "things": [
        "MyOtherLightBulb",
        "MyLightBulb"
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[账单组](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-billing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListThingsInBillingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-things-in-billing-group.html)*中的。

### `list-things-in-thing-group`
<a name="iot_ListThingsInThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-things-in-thing-group`。

**AWS CLI**  
**列出属于某个组的事物**  
以下 `list-things-in-thing-group` 示例列出属于指定事物组的事物。  

```
aws iot list-things-in-thing-group \
    --thing-group-name LightBulbs
```
输出：  

```
{
    "things": [
        "MyLightBulb"
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListThingsInThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-things-in-thing-group.html)*中的。

### `list-things`
<a name="iot_ListThings_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-things`。

**AWS CLI**  
**示例 1：列出注册表中的所有事物**  
以下`list-things`示例列出了在您的 AWS 账户的 AWS IoT 注册表中定义的事物（设备）。  

```
aws iot list-things
```
输出：  

```
{
    "things": [
        {
            "thingName": "ThirdBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/ThirdBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 2
        },
        {
            "thingName": "MyOtherLightBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 3
        },
        {
            "thingName": "MyLightBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 1
        },
        {
        "thingName": "SampleIoTThing",
        "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/SampleIoTThing",
        "attributes": {},
        "version": 1
        }
    ]
}
```
**示例 2：列出具有特定属性的已定义事物**  
以下 `list-things` 示例显示了具有名为 `wattage` 的属性的事物列表。  

```
aws iot list-things \
    --attribute-name wattage
```
输出：  

```
{
    "things": [
        {
            "thingName": "MyLightBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 1
        },
        {
            "thingName": "MyOtherLightBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 3
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[如何使用注册表管理事物](https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListThings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-things.html)*中的。

### `list-topic-rule-destinations`
<a name="iot_ListTopicRuleDestinations_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-topic-rule-destinations`。

**AWS CLI**  
**列出您的主题规则目标**  
以下`list-topic-rule-destinations`示例列出了您在当前 AWS 区域中定义的所有主题规则目的地。  

```
aws iot list-topic-rule-destinations
```
输出：  

```
{
    "destinationSummaries": [
        {
            "arn": "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
            "status": "ENABLED",
            "httpUrlSummary": {
                "confirmationUrl": "https://example.com"
            }
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[使用主题规则目标](https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListTopicRuleDestinations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-topic-rule-destinations.html)*中的。

### `list-topic-rules`
<a name="iot_ListTopicRules_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-topic-rules`。

**AWS CLI**  
**列出您的规则**  
以下 `list-topic-rules` 示例列出您定义的所有规则。  

```
aws iot list-topic-rules
```
输出：  

```
{
    "rules": [
        {
            "ruleArn": "arn:aws:iot:us-west-2:123456789012:rule/MyRPiLowMoistureAlertRule",
            "ruleName": "MyRPiLowMoistureAlertRule",
            "topicPattern": "$aws/things/MyRPi/shadow/update/accepted",
            "createdAt": 1558624363.0,
            "ruleDisabled": false
        },
        {
            "ruleArn": "arn:aws:iot:us-west-2:123456789012:rule/MyPlantPiMoistureAlertRule",
            "ruleName": "MyPlantPiMoistureAlertRule",
            "topicPattern": "$aws/things/MyPlantPi/shadow/update/accepted",
            "createdAt": 1541458459.0,
            "ruleDisabled": false
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[查看您的规则](https://docs.aws.amazon.com/iot/latest/developerguide/iot-managae-rule.html#iot-view-rules)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListTopicRules](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-topic-rules.html)*中的。

### `list-v2-logging-levels`
<a name="iot_ListV2LoggingLevels_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-v2-logging-levels`。

**AWS CLI**  
**列出日志级别**  
以下 `list-v2-logging-levels` 示例列出配置的日志级别。如果未设置日志级别，则运行此命令时会出现 `NotConfiguredException`。  

```
aws iot list-v2-logging-levels
```
输出：  

```
{
    "logTargetConfigurations": [
        {
            "logTarget": {
                "targetType": "DEFAULT"
            },
            "logLevel": "ERROR"
        }
    ]
}
```
+  有关 API 的详细信息，请参阅《*AWS CLI 命令*参考》LoggingLevels中的 [ListV2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-v2-logging-levels.html)。

### `list-violation-events`
<a name="iot_ListViolationEvents_cli_2_topic"></a>

以下代码示例演示了如何使用 `list-violation-events`。

**AWS CLI**  
**列出一段时间内安全配置文件违规情况**  
以下`list-violation-events`示例列出了当前 AWS 账户和 AWS 地区的所有 AWS IoT Device Defender 安全配置文件在 2019 年 6 月 5 日至 2019 年 6 月 12 日期间发生的违规行为。  

```
aws iot list-violation-events \
    --start-time 1559747125 \
    --end-time 1560351925
```
输出：  

```
{
    "violationEvents": [
        {
            "violationId": "174db59167fa474c80a652ad1583fd44",
            "thingName": "iotconsole-1560269126751-1",
            "securityProfileName": "Testprofile",
            "behavior": {
                "name": "Authorization",
                "metric": "aws:num-authorization-failures",
                "criteria": {
                    "comparisonOperator": "greater-than",
                    "value": {
                        "count": 10
                    },
                    "durationSeconds": 300,
                    "consecutiveDatapointsToAlarm": 1,
                    "consecutiveDatapointsToClear": 1
                }
            },
            "metricValue": {
                "count": 0
            },
            "violationEventType": "in-alarm",
            "violationEventTime": 1560279000.0
        },
        {
            "violationId": "c8a9466a093d3b7b35cd44ca58bdbeab",
            "thingName": "TvnQoEoU",
            "securityProfileName": "Testprofile",
            "behavior": {
                "name": "CellularBandwidth",
                "metric": "aws:message-byte-size",
                "criteria": {
                    "comparisonOperator": "greater-than",
                    "value": {
                        "count": 128
                    },
                    "consecutiveDatapointsToAlarm": 1,
                    "consecutiveDatapointsToClear": 1
                }
            },
            "metricValue": {
                "count": 110
            },
            "violationEventType": "in-alarm",
            "violationEventTime": 1560276600.0
        },
        {
            "violationId": "74aa393adea02e6648f3ac362beed55e",
            "thingName": "iotconsole-1560269232412-2",
            "securityProfileName": "Testprofile",
            "behavior": {
                "name": "Authorization",
                "metric": "aws:num-authorization-failures",
                "criteria": {
                    "comparisonOperator": "greater-than",
                    "value": {
                        "count": 10
                    },
                    "durationSeconds": 300,
                    "consecutiveDatapointsToAlarm": 1,
                    "consecutiveDatapointsToClear": 1
                }
            },
            "metricValue": {
                "count": 0
            },
            "violationEventType": "in-alarm",
            "violationEventTime": 1560276600.0
        },
        {
            "violationId": "1e6ab5f7cf39a1466fcd154e1377e406",
            "thingName": "TvnQoEoU",
            "securityProfileName": "Testprofile",
            "behavior": {
                "name": "Authorization",
                "metric": "aws:num-authorization-failures",
                "criteria": {
                    "comparisonOperator": "greater-than",
                    "value": {
                        "count": 10
                    },
                    "durationSeconds": 300,
                    "consecutiveDatapointsToAlarm": 1,
                    "consecutiveDatapointsToClear": 1
                }
            },
            "metricValue": {
                "count": 0
            },
            "violationEventType": "in-alarm",
            "violationEventTime": 1560276600.0
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ListViolationEvents](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-violation-events.html)*中的。

### `register-ca-certificate`
<a name="iot_RegisterCaCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `register-ca-certificate`。

**AWS CLI**  
**注册证书颁发机构（CA）证书**  
以下 `register-ca-certificate` 示例注册了 CA 证书。该命令提供 CA 证书和一个密钥验证证书，后者证明您拥有与 CA 证书关联的私钥。  

```
aws iot register-ca-certificate \
    --ca-certificate file://rootCA.pem \
    --verification-cert file://verificationCert.pem
```
输出：  

```
{
    "certificateArn": "arn:aws:iot:us-west-2:123456789012:cacert/f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467",
    "certificateId": "f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467"
 }
```
有关更多信息，请参阅《*AWS IoT API 参考*》CACertificate中的[注册](https://docs.aws.amazon.com/iot/latest/apireference/API_RegisterCACertificate.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[RegisterCaCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/register-ca-certificate.html)*中的。

### `register-certificate`
<a name="iot_RegisterCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `register-certificate`。

**AWS CLI**  
**注册自签名设备证书**  
以下 `register-certificate` 示例注册由 `rootCA.pem` CA 证书签名的 `deviceCert.pem` 设备证书。必须先注册 CA 证书，然后才能使用它来注册自签名设备证书。自签名证书必须由您传递给此命令的相同 CA 证书签名。  

```
aws iot register-certificate \
    --certificate-pem file://deviceCert.pem \
    --ca-certificate-pem file://rootCA.pem
```
输出：  

```
{
    "certificateArn": "arn:aws:iot:us-west-2:123456789012:cert/488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142",
    "certificateId": "488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142"
 }
```
有关更多信息，请参阅 *AWS IoT API 参考[RegisterCertificate](https://docs.aws.amazon.com/iot/latest/apireference/API_RegisterCertificate.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[RegisterCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/register-certificate.html)*中的。

### `register-thing`
<a name="iot_RegisterThing_cli_2_topic"></a>

以下代码示例演示了如何使用 `register-thing`。

**AWS CLI**  
**注册事物**  
以下 `register-thing` 示例使用预配模板注册事物。  

```
aws iot register-thing \
    --template-body '{"Parameters":{"ThingName":{"Type":"String"},"AWS::IoT::Certificate::Id":{"Type":"String"}},"Resources": {"certificate":{"Properties":{"CertificateId":{"Ref":"AWS::IoT::Certificate::Id"},"Status":"Active"},"Type":"AWS::IoT::Certificate"},"policy":{"Properties":{"PolicyName":"MyIotPolicy"},"Type":"AWS::IoT::Policy"},"thing":{"OverrideSettings":{"AttributePayload":"MERGE","ThingGroups":"DO_NOTHING","ThingTypeName":"REPLACE"},"Properties":{"AttributePayload":{},"ThingGroups":[],"ThingName":{"Ref":"ThingName"},"ThingTypeName":"VirtualThings"},"Type":"AWS::IoT::Thing"}}}' \
    --parameters '{"ThingName":"Register-thing-trial-1","AWS::IoT::Certificate::Id":"799a9ea048a1e6aea42b55EXAMPLEf8697b4bafcd77a318a3068e30404b9233c"}'
```
输出：  

```
{
    "certificatePem": "-----BEGIN CERTIFICATE-----\nMIIDWTCCAkGgAwIBAgIUYLk81I35cIppobpw
HiOJ2jNjboIwDQYJKoZIhvcNAQEL\nBQAwTTFLMEkGA1UECwxCQW1hem9uIFdlYiBTZXJ2aWNlcyBPPUFtYXpvbi
5jb20g\nSW5jLiBMPVNlYXR0bGUgU1Q9V2FzaGluZ3RvbiBDPVVTMB4XDTIwMDcyMzE2NDUw\nOVoXDTQ5MTIzMT
IzNTk1OVowHjEcMBoGA1UEAwwTQVdTIElvVCBDZXJ0aWZpY2F0\nZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAO71uADhdBajqTmgrMV5\nmCFfBZQRMo1MdtVoZr2X+M4MzL+RARrtUzH9a2SMAckeX8KeblIOTKzORI
RDXnyE\n6lVOwjgAsd0ku22rFxex4eG2ikha7pYYkvuToqA7L3TxItRvfKrxRI4ZfJoFPip4\nKqiuBJVNOGKTcQ
Hd1RNOrddwwu6kFJLeKDmEXAMPLEdUF0N+qfR9yKnZQkm+g6Q2\nGXu7u0W3hn6nlRN8qVoka0uW12p53xM7oHVz
Gf+cxKBxlbOhGkp6yCfTSkUBm3Sp\n9zLw35kiHXVm4EVpwgNlnk6XcIGIkw8a/iy4pzmvuGAANY1/uU/zgCjymw
ZT5S30\nBV0CAwEAAaNgMF4wHwYDVR0jBBgwFoAUGx0tCcU3q2n1WXAuUCv6hugXjKswHQYD\nVR0OBBYEFOVtvZ
9Aj2RYFnkX7Iu01XTRUdxgMAwGA1UdEwEB/wQCMAAwDgYDVR0P\nAQH/BAQDAgeAMA0GCSqGSIb3DQEBCwUAA4IB
AQCXCQcpOtubS5ftOsDMTcpP/jNX\nDHyArxmjpSc2aCdmm7WX59lTKWyAdxGAvqaDVWqTo0oXI7tZ8w7aINlGi5
pXnifx\n3SBebMUoBbTktrC97yUaeL025mCFv8emDnTR/fE7PTsBKjW0g/rrfpwBxZLXDFwN\nnqkQjy3EDfifj2
6j0xYIqqWMPogyn4srOCKynS5wMJuQZlHQOnabVwnwK4Y0Mflp\np9+4susFUR9aT3BT1AcIwqSpzhlKhh4Iz7ND
kRn4amsUT210jg/zOO1Ow+BTHcVQ\nJly8XDu0CWSu04q6SnaBzHmlySIajxuRTP/AdfRouP1OXe+qlbPOBcvVvF
8o\n-----END CERTIFICATE-----\n",
    "resourceArns": {
        "certificate": "arn:aws:iot:us-west-2:571032923833:cert/799a9ea048a1e6aea42b55EXAMPLEf8697b4bafcd77a318a3068e30404b9233c",
        "thing": "arn:aws:iot:us-west-2:571032923833:thing/Register-thing-trial-1"
    }
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[通过可信用户预配](https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#trusted-user)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[RegisterThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/register-thing.html)*中的。

### `reject-certificate-transfer`
<a name="iot_RejectCertificateTransfer_cli_2_topic"></a>

以下代码示例演示了如何使用 `reject-certificate-transfer`。

**AWS CLI**  
**拒绝证书转移**  
以下`reject-certificate-transfer`示例拒绝从其他 AWS 账户转移指定的设备证书。  

```
aws iot reject-certificate-transfer \
    --certificate-id f0f33678c7c9a046e5cc87b2b1a58dfa0beec26db78addd5e605d630e05c7fc8
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[将证书转移到另一个账户](https://docs.aws.amazon.com/iot/latest/developerguide/transfer-cert.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[RejectCertificateTransfer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/reject-certificate-transfer.html)*中的。

### `remove-thing-from-billing-group`
<a name="iot_RemoveThingFromBillingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `remove-thing-from-billing-group`。

**AWS CLI**  
**从账单组移除事物**  
以下 `remove-thing-from-billing-group` 示例从一个账单组移除指定事物。  

```
aws iot remove-thing-from-billing-group \
    --billing-group-name GroupOne \
    --thing-name MyOtherLightBulb
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[账单组](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-billing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[RemoveThingFromBillingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/remove-thing-from-billing-group.html)*中的。

### `remove-thing-from-thing-group`
<a name="iot_RemoveThingFromThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `remove-thing-from-thing-group`。

**AWS CLI**  
**从事物组中移除事物**  
以下 `remove-thing-from-thing-group` 示例从一个事物组移除指定事物。  

```
aws iot remove-thing-from-thing-group \
    --thing-name bulb7 \
    --thing-group-name DeadBulbs
```
此命令不生成任何输出。  
有关更多信息，请参阅《*AWS 物联网开发者指南》中的事物*组 < https://docs.aws.amazon.com/iot/ latest/developerguide/thing-groups.html >。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[RemoveThingFromThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/remove-thing-from-thing-group.html)*中的。

### `replace-topic-rule`
<a name="iot_ReplaceTopicRule_cli_2_topic"></a>

以下代码示例演示了如何使用 `replace-topic-rule`。

**AWS CLI**  
**更新主题的规则定义**  
以下 `replace-topic-rule` 示例更新了指定规则，以便在土壤湿度读数过低时发送 SNS 警报。  

```
aws iot replace-topic-rule \
    --rule-name MyRPiLowMoistureAlertRule \
    --topic-rule-payload "{\"sql\": \"SELECT * FROM '$aws/things/MyRPi/shadow/update/accepted' WHERE state.reported.moisture = 'low'\", \"description\": \"Sends an alert when soil moisture level readings are too low.\",\"actions\": [{\"sns\":{\"targetArn\":\"arn:aws:sns:us-west-2:123456789012:MyRPiLowMoistureTopic\",\"roleArn\":\"arn:aws:iam::123456789012:role/service-role/MyRPiLowMoistureTopicRole\",\"messageFormat\": \"RAW\"}}],\"ruleDisabled\": false,\"awsIotSqlVersion\":\"2016-03-23\"}"
```
此命令不生成任何输出。  
有关更多信息，请参阅《[AWS 物联网*开发者指南》中的创建AWS 物联网*规则](https://docs.aws.amazon.com/iot/latest/developerguide/iot-create-rule.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ReplaceTopicRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/replace-topic-rule.html)*中的。

### `search-index`
<a name="iot_SearchIndex_cli_2_topic"></a>

以下代码示例演示了如何使用 `search-index`。

**AWS CLI**  
**查询事物索引**  
以下 `search-index` 示例在 `AWS_Things` 索引中查询类型为 `LightBulb` 的事物。  

```
aws iot search-index \
    --index-name "AWS_Things" \
    --query-string "thingTypeName:LightBulb"
```
输出：  

```
{
    "things": [
        {
            "thingName": "MyLightBulb",
            "thingId": "40da2e73-c6af-406e-b415-15acae538797",
            "thingTypeName": "LightBulb",
            "thingGroupNames": [
                "LightBulbs",
                "DeadBulbs"
            ],
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "connectivity": {
                "connected": false
            }
        },
        {
            "thingName": "ThirdBulb",
            "thingId": "615c8455-33d5-40e8-95fd-3ee8b24490af",
            "thingTypeName": "LightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "connectivity": {
                "connected": false
            }
        },
        {
            "thingName": "MyOtherLightBulb",
            "thingId": "6dae0d3f-40c1-476a-80c4-1ed24ba6aa11",
            "thingTypeName": "LightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "connectivity": {
                "connected": false
            }
        }
    ]
}
```
有关更多信息，请参阅《AWS 物联网开发人员指南》**中的[管理事物索引](https://docs.aws.amazon.com/iot/latest/developerguide/managing-index.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[SearchIndex](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/search-index.html)*中的。

### `set-default-authorizer`
<a name="iot_SetDefaultAuthorizer_cli_2_topic"></a>

以下代码示例演示了如何使用 `set-default-authorizer`。

**AWS CLI**  
**设置默认授权方**  
以下 `set-default-authorizer` 示例将名为 `CustomAuthorizer` 的自定义授权方设置为默认授权方。  

```
aws iot set-default-authorizer \
    --authorizer-name CustomAuthorizer
```
输出：  

```
{
    "authorizerName": "CustomAuthorizer",
    "authorizerArn": "arn:aws:iot:us-west-2:123456789012:authorizer/CustomAuthorizer"
}
```
有关更多信息，请参阅 *AWS IoT API 参考[CreateDefaultAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateDefaultAuthorizer.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[SetDefaultAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/set-default-authorizer.html)*中的。

### `set-default-policy-version`
<a name="iot_SetDefaultPolicyVersion_cli_2_topic"></a>

以下代码示例演示了如何使用 `set-default-policy-version`。

**AWS CLI**  
**为策略设置默认版本**  
以下 `set-default-policy-version` 示例对于名为 `UpdateDeviceCertPolicy` 的策略将默认版本设置为 `2`。  

```
aws iot set-default-policy-version \
    --policy-name UpdateDeviceCertPolicy \
    --policy-version-id 2
```
此命令不生成任何输出。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[SetDefaultPolicyVersion](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/set-default-policy-version.html)*中的。

### `set-v2-logging-level`
<a name="iot_SetV2LoggingLevel_cli_2_topic"></a>

以下代码示例演示了如何使用 `set-v2-logging-level`。

**AWS CLI**  
**为事物组设置日志级别**  
以下 `set-v2-logging-level` 示例对于指定事物组将日志级别设置为日志警告。  

```
aws iot set-v2-logging-level \
    --log-target "{\"targetType\":\"THING_GROUP\",\"targetName\":\"LightBulbs\"}" \
    --log-level WARN
```
此命令不生成任何输出。  
+  有关 API 的详细信息，请参阅《*AWS CLI 命令*参考LoggingLevel》中的 [setV2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/set-v2-logging-level.html)。

### `set-v2-logging-options`
<a name="iot_SetV2LoggingOptions_cli_2_topic"></a>

以下代码示例演示了如何使用 `set-v2-logging-options`。

**AWS CLI**  
**设置日志选项**  
以下 `set-v2-logging-options` 示例将默认的日志详细级别设置为 ERROR，并指定 ARN 用于日志记录。  

```
aws iot set-v2-logging-options \
    --default-log-level ERROR \
    --role-arn "arn:aws:iam::094249569039:role/service-role/iotLoggingRole"
```
此命令不生成任何输出。  
+  有关 API 的详细信息，请参阅《*AWS CLI 命令*参考LoggingOptions》中的 [setV2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/set-v2-logging-options.html)。

### `start-audit-mitigation-actions-task`
<a name="iot_StartAuditMitigationActionsTask_cli_2_topic"></a>

以下代码示例演示了如何使用 `start-audit-mitigation-actions-task`。

**AWS CLI**  
**对审计的调查发现应用缓解操作**  
以下 `start-audit-mitigation-actions-task` 示例将 `ResetPolicyVersionAction` 操作（清除策略）应用于指定的单个调查发现。  

```
aws iot start-audit-mitigation-actions-task \
    --task-id "myActionsTaskId" \
    --target "findingIds=[\"0edbaaec-2fe1-4cf5-abc9-d4c3e51f7464\"]" \
    --audit-check-to-actions-mapping "IOT_POLICY_OVERLY_PERMISSIVE_CHECK=[\"ResetPolicyVersionAction\"]" \
    --client-request-token "adhadhahda"
```
输出：  

```
{
    "taskId": "myActionsTaskId"
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [StartAuditMitigationActionsTask （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-StartAuditMitigationActionsTask)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[StartAuditMitigationActionsTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/start-audit-mitigation-actions-task.html)*中的。

### `start-on-demand-audit-task`
<a name="iot_StartOnDemandAuditTask_cli_2_topic"></a>

以下代码示例演示了如何使用 `start-on-demand-audit-task`。

**AWS CLI**  
**立即启动审计**  
以下`start-on-demand-audit-task`示例启动 AWS IoT Device Defender 审核并执行三次证书检查。  

```
aws iot start-on-demand-audit-task \
    --target-check-names CA_CERTIFICATE_EXPIRING_CHECK DEVICE_CERTIFICATE_EXPIRING_CHECK REVOKED_CA_CERTIFICATE_STILL_ACTIVE_CHECK
```
输出：  

```
{
    "taskId": "a3aea009955e501a31b764abe1bebd3d"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[StartOnDemandAuditTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/start-on-demand-audit-task.html)*中的。

### `tag-resource`
<a name="iot_TagResource_cli_2_topic"></a>

以下代码示例演示了如何使用 `tag-resource`。

**AWS CLI**  
**为资源指定标签键和值**  
以下 `tag-resource` 示例将键为 `Assembly` 且值为 `Fact1NW` 的标签应用于事物组 `LightBulbs`。  

```
aws iot tag-resource \
    --tags Key=Assembly,Value="Fact1NW" \
    --resource-arn "arn:aws:iot:us-west-2:094249569039:thinggroup/LightBulbs"
```
此命令不生成任何输出。  
有关更多信息，请参阅《[AWS 物联网*开发者指南》中的为物AWS 联网*资源添加标签](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/tag-resource.html)*中的。

### `test-authorization`
<a name="iot_TestAuthorization_cli_2_topic"></a>

以下代码示例演示了如何使用 `test-authorization`。

**AWS CLI**  
**测试您的 AWS 物联网政策**  
以下`test-authorization`示例测试与指定委托人关联的 AWS IoT 策略。  

```
aws iot test-authorization \
    --auth-infos actionType=CONNECT,resources=arn:aws:iot:us-east-1:123456789012:client/client1 \
    --principal arn:aws:iot:us-west-2:123456789012:cert/aab1068f7f43ac3e3cae4b3a8aa3f308d2a750e6350507962e32c1eb465d9775
```
输出：  

```
{
    "authResults": [
        {
            "authInfo": {
                "actionType": "CONNECT",
                "resources": [
                    "arn:aws:iot:us-east-1:123456789012:client/client1"
                ]
            },
            "allowed": {
                "policies": [
                    {
                        "policyName": "TestPolicyAllowed",
                        "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/TestPolicyAllowed"
                    }
                ]
            },
            "denied": {
                "implicitDeny": {
                    "policies": [
                        {
                            "policyName": "TestPolicyDenied",
                            "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/TestPolicyDenied"
                        }
                    ]
                },
                "explicitDeny": {
                    "policies": [
                        {
                            "policyName": "TestPolicyExplicitDenied",
                            "policyArn": "arn:aws:iot:us-west-2:123456789012:policy/TestPolicyExplicitDenied"
                        }
                    ]
                }
            },
            "authDecision": "IMPLICIT_DENY",
            "missingContextValues": []
        }
    ]
}
```
有关更多信息，请参阅 *AWS IoT API 参考[TestAuthorization](https://docs.aws.amazon.com/iot/latest/apireference/API_TestAuthorization.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[TestAuthorization](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/test-authorization.html)*中的。

### `test-invoke-authorizer`
<a name="iot_TestInvokeAuthorizer_cli_2_topic"></a>

以下代码示例演示了如何使用 `test-invoke-authorizer`。

**AWS CLI**  
**测试您的自定义授权方**  
以下 `test-invoke-authorizer` 示例测试您的自定义授权方。  

```
aws iot test-invoke-authorizer \
    --authorizer-name IoTAuthorizer \
    --token allow \
    --token-signature "mE0GvaHqy9nER/FdgtJX5lXYEJ3b3vE7t1gEszc0TKGgLKWXTnPkb2AbKnOAZ8lGyoN5dVtWDWVmr25m7++zjbYIMk2TBvyGXhOmvKFBPkdgyA43KL6SiZy0cTqlPMcQDsP7VX2rXr7CTowCxSNKphGXdQe0/I5dQ+JO6KUaHwCmupt0/MejKtaNwiia064j6wprOAUwG5S1IYFuRd0X+wfo8pb0DubAIX1Ua705kuhRUcTx4SxUShEYKmN4IDEvLB6FsIr0B2wvB7y4iPmcajxzGl02ExvyCUNctCV9dYlRRGJj0nsGzBIXOI4sGytPfqlA7obdgmN22pkDzYvwjQ=="
```
输出：  

```
{
    "isAuthenticated": true,
    "principalId": "principalId",
    "policyDocuments": [
        "{"Version":"2012-10-17",		 	 	 "Statement":[{"Action":"iot:Publish","Effect":"Allow","Resource":"arn:aws:iot:us-west-2:123456789012:topic/customauthtesting"}]}"
    ],
    "refreshAfterInSeconds": 600,
    "disconnectAfterInSeconds": 3600
}
```
有关更多信息，请参阅 *AWS IoT API 参考[TestInvokeAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_TestInvokeAuthorizers.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[TestInvokeAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/test-invoke-authorizer.html)*中的。

### `transfer-certificate`
<a name="iot_TransferCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `transfer-certificate`。

**AWS CLI**  
**将设备证书转移到其他 AWS 账户**  
以下`transfer-certificate`示例将设备证书转移到另一个 AWS 账户。证书和 AWS 账户由 ID 标识。  

```
aws iot transfer-certificate \
    --certificate-id 488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142 \
    --target-aws-account 030714055129
```
输出：  

```
{
    "transferredCertificateArn": "arn:aws:iot:us-west-2:030714055129:cert/488b6a7f2acdeb00a77384e63c4e40b18b1b3caaae57b7272ba44c45e3448142"
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[将证书转移到另一个账户](https://docs.aws.amazon.com/iot/latest/developerguide/transfer-cert.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[TransferCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/transfer-certificate.html)*中的。

### `untag-resource`
<a name="iot_UntagResource_cli_2_topic"></a>

以下代码示例演示了如何使用 `untag-resource`。

**AWS CLI**  
**从资源中删除标签键**  
以下 `untag-resource` 示例从事物组 `LightBulbs` 中移除标签 `MyTag` 及其值。  

```
command
```
此命令不生成任何输出。  
有关更多信息，请参阅《[AWS 物联网*开发者指南》中的为物AWS 联网*资源添加标签](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/untag-resource.html)*中的。

### `update-account-audit-configuration`
<a name="iot_UpdateAccountAuditConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-account-audit-configuration`。

**AWS CLI**  
**示例 1：为审计通知启用 Amazon SNS 通知**  
以下`update-account-audit-configuration`示例为 AWS IoT Device Defender 审计通知启用 Amazon SNS 通知，指定目标和用于写入该目标的角色。  

```
aws iot update-account-audit-configuration \
    --audit-notification-target-configurations "SNS={targetArn=\"arn:aws:sns:us-west-2:123456789012:ddaudits\",roleArn=\"arn:aws:iam::123456789012:role/service-role/AWSIoTDeviceDefenderAudit\",enabled=true}"
```
此命令不生成任何输出。  
**示例 2：启用审计检查**  
以下`update-account-audit-configuration`示例启用名为的 AWS IoT Device Defender 审核检查`AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK`。如果审计检查是 AWS 账户一项或多项计划审计的一部分，则不能将其禁用。`targetCheckNames`  

```
aws iot update-account-audit-configuration \
    --audit-check-configurations "{\"AUTHENTICATED_COGNITO_ROLE_OVERLY_PERMISSIVE_CHECK\":{\"enabled\":true}}"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateAccountAuditConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-account-audit-configuration.html)*中的。

### `update-audit-suppression`
<a name="iot_UpdateAuditSuppression_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-audit-suppression`。

**AWS CLI**  
**更新审计调查发现抑制**  
以下 `update-audit-suppression` 示例将审计调查发现抑制的到期日期更新为 2020-09-21。  

```
aws iot update-audit-suppression \
    --check-name DEVICE_CERTIFICATE_EXPIRING_CHECK \
    --resource-identifier deviceCertificateId=c7691e<shortened> \
    --no-suppress-indefinitely \
    --expiration-date 2020-09-21
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[审计调查发现抑制](https://docs.aws.amazon.com/iot/latest/developerguide/audit-finding-suppressions.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateAuditSuppression](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-audit-suppression.html)*中的。

### `update-authorizer`
<a name="iot_UpdateAuthorizer_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-authorizer`。

**AWS CLI**  
**更新自定义授权方**  
以下 `update-authorizer` 示例将 `CustomAuthorizer2` 状态更新为 `INACTIVE`。  

```
aws iot update-authorizer \
    --authorizer-name CustomAuthorizer2 \
    --status INACTIVE
```
输出：  

```
{
    "authorizerName": "CustomAuthorizer2",
    "authorizerArn": "arn:aws:iot:us-west-2:123456789012:authorizer/CustomAuthorizer2"
}
```
有关更多信息，请参阅 *AWS IoT API 参考[UpdateAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_UpdateAuthorizer.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-authorizer.html)*中的。

### `update-billing-group`
<a name="iot_UpdateBillingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-billing-group`。

**AWS CLI**  
**更新有关账单组的信息**  
以下 `update-billing-group` 示例更新指定账单组的描述。  

```
aws iot update-billing-group \
    --billing-group-name GroupOne \
    --billing-group-properties "billingGroupDescription=\"Primary bulb billing group\""
```
输出：  

```
{
    "version": 2
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[账单组](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-billing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateBillingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-billing-group.html)*中的。

### `update-ca-certificate`
<a name="iot_UpdateCaCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-ca-certificate`。

**AWS CLI**  
**更新证书颁发机构（CA）证书**  
以下 `update-ca-certificate` 示例将指定的 CA 证书设置为“ACTIVE”状态。  

```
aws iot update-ca-certificate \
    --certificate-id f4efed62c0142f16af278166f61962501165c4f0536295207426460058cd1467 \
    --new-status ACTIVE
```
此命令不生成任何输出。  
有关更多信息，请参阅 *AWS IoT API 参考CACertificate*中的[更新](https://docs.aws.amazon.com/iot/latest/apireference/API_UpdateCACertificate.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateCaCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-ca-certificate.html)*中的。

### `update-certificate`
<a name="iot_UpdateCertificate_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-certificate`。

**AWS CLI**  
**更新设备证书**  
以下 `update-certificate` 示例将指定的设备证书设置为“INACTIVE”状态。  

```
aws iot update-certificate \
    --certificate-id d1eb269fb55a628552143c8f96eb3c258fcd5331ea113e766ba0c82bf225f0be \
    --new-status INACTIVE
```
此命令不生成任何输出。  
有关更多信息，请参阅 *AWS IoT API 参考[UpdateCertificate](https://docs.aws.amazon.com/iot/latest/apireference/API_UpdateCertificate.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-certificate.html)*中的。

### `update-custom-metric`
<a name="iot_UpdateCustomMetric_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-custom-metric`。

**AWS CLI**  
**更新自定义指标**  
以下 `update-custom-metric` 示例更新一个自定义指标以使用新的 `display-name`。  

```
aws iot update-custom-metric \
    --metric-name batteryPercentage \
    --display-name 'remaining battery percentage on device' \
    --region us-east-1
```
输出：  

```
{
    "metricName": "batteryPercentage",
    "metricArn": "arn:aws:iot:us-east-1:1234564789012:custommetric/batteryPercentage",
    "metricType": "number",
    "displayName": "remaining battery percentage on device",
    "creationDate": "2020-11-17T23:01:35.110000-08:00",
    "lastModifiedDate": "2020-11-17T23:02:12.879000-08:00"
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[自定义指标](https://docs.aws.amazon.com/iot/latest/developerguide/dd-detect-custom-metrics.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateCustomMetric](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-custom-metric.html)*中的。

### `update-dimension`
<a name="iot_UpdateDimension_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-dimension`。

**AWS CLI**  
**更新维度**  
以下 `update-dimension` 示例更新维度。  

```
aws iot update-dimension \
    --name TopicFilterForAuthMessages \
    --string-values device/${iot:ClientId}/auth
```
输出：  

```
{
    "name": "TopicFilterForAuthMessages",
    "lastModifiedDate": 1585866222.317,
    "stringValues": [
        "device/${iot:ClientId}/auth"
    ],
    "creationDate": 1585854500.474,
    "type": "TOPIC_FILTER",
    "arn": "arn:aws:iot:us-west-2:1234564789012:dimension/TopicFilterForAuthMessages"
}
```
有关更多信息，请参阅《AWS IoT Core 开发人员指南》**中的[使用维度确定指标在安全配置文件中的范围](https://docs.aws.amazon.com/iot/latest/developerguide/scoping-security-behavior.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateDimension](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-dimension.html)*中的。

### `update-domain-configuration`
<a name="iot_UpdateDomainConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-domain-configuration`。

**AWS CLI**  
**更新域配置**  
以下 `update-domain-configuration` 示例禁用指定域配置。  

```
aws iot update-domain-configuration \
    --domain-configuration-name "additionalDataDomain" \
    --domain-configuration-status "DISABLED"
```
输出：  

```
{
    "domainConfigurationName": "additionalDataDomain",
    "domainConfigurationArn": "arn:aws:iot:us-west-2:123456789012:domainconfiguration/additionalDataDomain/dikMh"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[可配置的端点](https://docs.aws.amazon.com/iot/latest/developerguide/iot-custom-endpoints-configurable-aws.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateDomainConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-domain-configuration.html)*中的。

### `update-dynamic-thing-group`
<a name="iot_UpdateDynamicThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-dynamic-thing-group`。

**AWS CLI**  
**更新动态事物组**  
以下 `update-dynamic-thing-group` 示例更新指定动态事物组。它提供描述并更新查询字符串以更改组成员资格标准。  

```
aws iot update-dynamic-thing-group \
    --thing-group-name "RoomTooWarm"
    --thing-group-properties "thingGroupDescription=\"This thing group contains rooms warmer than 65F.\"" \
    --query-string "attributes.temperature>65"
```
输出：  

```
{
    "version": 2
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[动态事物组](https://docs.aws.amazon.com/iot/latest/developerguide/dynamic-thing-groups.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateDynamicThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-dynamic-thing-group.html)*中的。

### `update-event-configurations`
<a name="iot_UpdateEventConfigurations_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-event-configurations`。

**AWS CLI**  
**显示已发布的事件类型**  
以下 `update-event-configurations` 示例更新配置以在添加、更新或删除 CA 证书时启用消息。  

```
aws iot update-event-configurations \
    --event-configurations "{\"CA_CERTIFICATE\":{\"Enabled\":true}}"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事件消息](https://docs.aws.amazon.com/iot/latest/developerguide/iot-events.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateEventConfigurations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-event-configurations.html)*中的。

### `update-indexing-configuration`
<a name="iot_UpdateIndexingConfiguration_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-indexing-configuration`。

**AWS CLI**  
**启用事物索引**  
以下`update-indexing-configuration`示例启用事物索引，以支持使用 AWS\$1Things 索引搜索注册表数据、影子数据和事物连接状态。  

```
aws iot update-indexing-configuration
    --thing-indexing-configuration thingIndexingMode=REGISTRY_AND_SHADOW,thingConnectivityIndexingMode=STATUS
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS 物联网开发人员指南》**中的[管理事物索引](https://docs.aws.amazon.com/iot/latest/developerguide/managing-index.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateIndexingConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-indexing-configuration.html)*中的。

### `update-job`
<a name="iot_UpdateJob_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-job`。

**AWS CLI**  
**获取作业的详细状态**  
以下 `update-job` 示例获取 ID 为 `example-job-01` 的作业的详细状态。  

```
aws iot describe-job \
    --job-id "example-job-01"
```
输出：  

```
{
    "job": {
        "jobArn": "arn:aws:iot:us-west-2:123456789012:job/example-job-01",
        "jobId": "example-job-01",
        "targetSelection": "SNAPSHOT",
        "status": "IN_PROGRESS",
        "targets": [
            "arn:aws:iot:us-west-2:123456789012:thing/MyRaspberryPi"
        ],
        "description": "example job test",
        "presignedUrlConfig": {},
        "jobExecutionsRolloutConfig": {},
        "createdAt": 1560787022.733,
        "lastUpdatedAt": 1560787026.294,
        "jobProcessDetails": {
            "numberOfCanceledThings": 0,
            "numberOfSucceededThings": 0,
            "numberOfFailedThings": 0,
            "numberOfRejectedThings": 0,
            "numberOfQueuedThings": 1,
            "numberOfInProgressThings": 0,
            "numberOfRemovedThings": 0,
            "numberOfTimedOutThings": 0
        },
        "timeoutConfig": {}
    }
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[创建和管理作业（CLI）](https://docs.aws.amazon.com/iot/latest/developerguide/manage-job-cli.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-job.html)*中的。

### `update-mitigation-action`
<a name="iot_UpdateMitigationAction_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-mitigation-action`。

**AWS CLI**  
**更新缓解操作**  
以下 `update-mitigation-action` 示例更新名为 `AddThingsToQuarantineGroupAction` 的指定缓解操作，更改事物组名称并设置 `overrideDynamicGroups` 为 `false`。您可以通过使用 `describe-mitigation-action` 命令来验证更改。  

```
aws iot update-mitigation-action \
    --cli-input-json "{ \"actionName\": \"AddThingsToQuarantineGroupAction\", \"actionParams\": { \"addThingsToThingGroupParams\": {\"thingGroupNames\":[\"QuarantineGroup2\"],\"overrideDynamicGroups\": false}}}"
```
输出：  

```
{
    "actionArn": "arn:aws:iot:us-west-2:123456789012:mitigationaction/AddThingsToQuarantineGroupAction",
    "actionId": "2fd2726d-98e1-4abf-b10f-09465ccd6bfa"
}
```
有关更多信息，请参阅《*AWS 物联网开发者指南*》中的 [UpdateMitigationAction （缓解操作命令）](https://docs.aws.amazon.com/iot/latest/developerguide/mitigation-action-commands.html#dd-api-iot-UpdateMitigationAction)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateMitigationAction](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-mitigation-action.html)*中的。

### `update-provisioning-template`
<a name="iot_UpdateProvisioningTemplate_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-provisioning-template`。

**AWS CLI**  
**更新预配模板**  
以下 `update-provisioning-template` 示例修改了指定预配模板的描述和角色 arn，并启用了该模板。  

```
aws iot update-provisioning-template \
    --template-name widget-template \
    --enabled \
    --description "An updated provisioning template for widgets" \
    --provisioning-role-arn arn:aws:iam::504350838278:role/Provision_role
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT Core 开发人员指南》中的 [AWS IoT 安全隧道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateProvisioningTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-provisioning-template.html)*中的。

### `update-role-alias`
<a name="iot_UpdateRoleAlias_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-role-alias`。

**AWS CLI**  
**更新角色别名**  
以下 `update-role-alias` 示例更新 `LightBulbRole` 角色别名。  

```
aws iot update-role-alias \
    --role-alias LightBulbRole \
    --role-arn arn:aws:iam::123456789012:role/lightbulbrole-001
```
输出：  

```
{
    "roleAlias": "LightBulbRole",
    "roleAliasArn": "arn:aws:iot:us-west-2:123456789012:rolealias/LightBulbRole"
}
```
有关更多信息，请参阅 *AWS IoT API 参考[UpdateRoleAlias](https://docs.aws.amazon.com/iot/latest/apireference/API_UpdateRoleAlias.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateRoleAlias](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-role-alias.html)*中的。

### `update-scheduled-audit`
<a name="iot_UpdateScheduledAudit_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-scheduled-audit`。

**AWS CLI**  
**更新预定审计定义**  
以下`update-scheduled-audit`示例更改了 AWS IoT Device Defender 计划审计的目标检查名称。  

```
aws iot update-scheduled-audit \
    --scheduled-audit-name WednesdayCertCheck \
    --target-check-names CA_CERTIFICATE_EXPIRING_CHECK DEVICE_CERTIFICATE_EXPIRING_CHECK REVOKED_CA_CERTIFICATE_STILL_ACTIVE_CHECK
```
输出：  

```
{
    "scheduledAuditArn": "arn:aws:iot:us-west-2:123456789012:scheduledaudit/WednesdayCertCheck"
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[审计命令](https://docs.aws.amazon.com/iot/latest/developerguide/AuditCommands.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateScheduledAudit](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-scheduled-audit.html)*中的。

### `update-security-profile`
<a name="iot_UpdateSecurityProfile_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-security-profile`。

**AWS CLI**  
**更改安全配置文件**  
以下`update-security-profile`示例更新了 AWS IoT Device Defender 安全配置文件的描述和行为。  

```
aws iot update-security-profile \
    --security-profile-name PossibleIssue \
    --security-profile-description "Check to see if authorization fails 12 times in 5 minutes or if cellular bandwidth exceeds 128"  \
    --behaviors "[{\"name\":\"CellularBandwidth\",\"metric\":\"aws:message-byte-size\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":128},\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}},{\"name\":\"Authorization\",\"metric\":\"aws:num-authorization-failures\",\"criteria\":{\"comparisonOperator\":\"less-than\",\"value\":{\"count\":12},\"durationSeconds\":300,\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}}]"
```
输出：  

```
{
    "securityProfileName": "PossibleIssue",
    "securityProfileArn": "arn:aws:iot:us-west-2:123456789012:securityprofile/PossibleIssue",
    "securityProfileDescription": "check to see if authorization fails 12 times in 5 minutes or if cellular bandwidth exceeds 128",
    "behaviors": [
        {
            "name": "CellularBandwidth",
            "metric": "aws:message-byte-size",
            "criteria": {
                "comparisonOperator": "greater-than",
                "value": {
                    "count": 128
                },
                "consecutiveDatapointsToAlarm": 1,
                "consecutiveDatapointsToClear": 1
            }
        },
        {
            "name": "Authorization",
            "metric": "aws:num-authorization-failures",
            "criteria": {
                "comparisonOperator": "less-than",
                "value": {
                    "count": 12
                },
                "durationSeconds": 300,
                "consecutiveDatapointsToAlarm": 1,
                "consecutiveDatapointsToClear": 1
            }
        }
    ],
    "version": 2,
    "creationDate": 1560278102.528,
    "lastModifiedDate": 1560352711.207
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateSecurityProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-security-profile.html)*中的。

### `update-stream`
<a name="iot_UpdateStream_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-stream`。

**AWS CLI**  
**更新流**  
以下 `update-stream` 示例更新一个现有流。流版本每次递增 1。  

```
aws iot update-stream \
    --cli-input-json file://update-stream.json
```
`update-stream.json` 的内容：  

```
{
    "streamId": "stream12345",
    "description": "This stream is used for Amazon FreeRTOS OTA Update 12345.",
    "files": [
        {
            "fileId": 123,
            "s3Location": {
                "bucket":"codesign-ota-bucket",
                "key":"48c67f3c-63bb-4f92-a98a-4ee0fbc2bef6"
            }
        }
    ]
    "roleArn": "arn:aws:iam:us-west-2:123456789012:role/service-role/my_ota_stream_role"
}
```
输出：  

```
{
    "streamId": "stream12345",
    "streamArn": "arn:aws:iot:us-west-2:123456789012:stream/stream12345",
    "description": "This stream is used for Amazon FreeRTOS OTA Update 12345.",
    "streamVersion": 2
}
```
有关更多信息，请参阅 *AWS IoT API 参考[UpdateStream](https://docs.aws.amazon.com/iot/latest/apireference/API_UpdateStream.html)*中的。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateStream](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-stream.html)*中的。

### `update-thing-group`
<a name="iot_UpdateThingGroup_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-thing-group`。

**AWS CLI**  
**更新事物组的定义**  
以下 `update-thing-group` 示例更新了指定事物组的定义，更改了描述和两个属性。  

```
aws iot update-thing-group \
    --thing-group-name HalogenBulbs \
    --thing-group-properties "thingGroupDescription=\"Halogen bulb group\", attributePayload={attributes={Manufacturer=AnyCompany,wattage=60}}"
```
输出：  

```
{
    "version": 2
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateThingGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-thing-group.html)*中的。

### `update-thing-groups-for-thing`
<a name="iot_UpdateThingGroupsForThing_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-thing-groups-for-thing`。

**AWS CLI**  
**更改事物所属的组**  
以下 `update-thing-groups-for-thing` 示例将名为 `MyLightBulb` 的事物从名为 `DeadBulbs` 的组中移除的同时，将其添加到名为 `replaceableItems` 的组中。  

```
aws iot update-thing-groups-for-thing \
    --thing-name MyLightBulb \
    --thing-groups-to-add "replaceableItems" \
    --thing-groups-to-remove "DeadBulbs"
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[事物组](https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateThingGroupsForThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-thing-groups-for-thing.html)*中的。

### `update-thing`
<a name="iot_UpdateThing_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-thing`。

**AWS CLI**  
**将事物与事物类型关联**  
以下`update-thing`示例将 AWS IoT 注册表中的事物与事物类型相关联。在建立这种关联时，需要为事物类型定义的属性提供值。  

```
aws iot update-thing \
    --thing-name "MyOtherLightBulb" \
    --thing-type-name "LightBulb" \
    --attribute-payload "{"attributes": {"wattage":"75", "model":"123"}}"
```
此命令不生成任何输出。使用 `describe-thing` 命令查看结果。  
有关更多信息，请参阅*《AWS 物联网开发人员指南》*中的[事物类型](https://docs.aws.amazon.com/iot/latest/developerguide/thing-types.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-thing.html)*中的。

### `update-topic-rule-destination`
<a name="iot_UpdateTopicRuleDestination_cli_2_topic"></a>

以下代码示例演示了如何使用 `update-topic-rule-destination`。

**AWS CLI**  
**示例 1：启用主题规则目标**  
以下 `update-topic-rule-destination` 示例启用流向主题规则目标的流量。  

```
aws iot update-topic-rule-destination \
    --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" \
    --status ENABLED
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[启用主题规则目标](https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#enable-destination)。  
**示例 2：禁用主题规则目标**  
以下 `update-topic-rule-destination` 示例禁用流向主题规则目标的流量。  

```
aws iot update-topic-rule-destination \
    --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" \
    --status DISABLED
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[禁用主题规则目标](https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#disable-destination)。  
**示例 3：发送新的确认消息**  
以下 `update-topic-rule-destination` 示例为主题规则目标发送了一条新的确认消息。  

```
aws iot update-topic-rule-destination \
    --arn "arn:aws:iot:us-west-2:123456789012:ruledestination/http/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" \
    --status IN_PROGRESS
```
此命令不生成任何输出。  
有关更多信息，请参阅《AWS IoT 开发人员指南》**中的[发送新的确认消息](https://docs.aws.amazon.com/iot/latest/developerguide/rule-destination.html#trigger-confirm)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateTopicRuleDestination](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-topic-rule-destination.html)*中的。

### `validate-security-profile-behaviors`
<a name="iot_ValidateSecurityProfileBehaviors_cli_2_topic"></a>

以下代码示例演示了如何使用 `validate-security-profile-behaviors`。

**AWS CLI**  
**示例 1：验证安全配置文件的行为参数**  
以下`validate-security-profile-behaviors`示例验证了 AWS IoT Device Defender 安全配置文件的一组格式正确且正确的行为。  

```
aws iot validate-security-profile-behaviors \
    --behaviors "[{\"name\":\"CellularBandwidth\",\"metric\":\"aws:message-byte-size\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":128},\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}},{\"name\":\"Authorization\",\"metric\":\"aws:num-authorization-failures\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":12},\"durationSeconds\":300,\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}}]"
```
输出：  

```
{
    "valid": true,
    "validationErrors": []
}
```
**示例 2：验证安全配置文件的不正确行为参数**  
以下`validate-security-profile-behaviors`示例验证了一组包含 AWS IoT Device Defender 安全配置文件错误的行为。  

```
aws iot validate-security-profile-behaviors \
    --behaviors "[{\"name\":\"CellularBandwidth\",\"metric\":\"aws:message-byte-size\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":128},\"consecutiveDatapointsToAlarm\":1,\"consecutiveDatapointsToClear\":1}},{\"name\":\"Authorization\",\"metric\":\"aws:num-authorization-failures\",\"criteria\":{\"comparisonOperator\":\"greater-than\",\"value\":{\"count\":12},\"durationSeconds\":300,\"consecutiveDatapointsToAlarm\":100000,\"consecutiveDatapointsToClear\":1}}]"
```
输出：  

```
{
    "valid": false,
    "validationErrors": [
        {
            "errorMessage": "Behavior Authorization is malformed. consecutiveDatapointsToAlarm 100000 should be in range[1,10]"
        }
    ]
}
```
有关更多信息，请参阅《AWS IoT 开发人员指南》中的[检测命令](https://docs.aws.amazon.com/iot/latest/developerguide/DetectCommands.html)。**  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[ValidateSecurityProfileBehaviors](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/validate-security-profile-behaviors.html)*中的。