

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 [AWS SDK 範例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

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

下列程式碼範例示範如何使用 AWS Command Line Interface 搭配 來執行動作和實作常見案例 AWS IoT。

*Actions* 是大型程式的程式碼摘錄，必須在內容中執行。雖然動作會告訴您如何呼叫個別服務函數，但您可以在其相關情境中查看內容中的動作。

每個範例均包含完整原始碼的連結，您可在連結中找到如何設定和執行內容中程式碼的相關指示。

**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 IoT 開發人員指南中的將 IoT 政策連接至裝置憑證](https://docs.aws.amazon.com/iot/latest/developerguide/attach-policy-to-certificate.html)。 *AWS IoT *  
+  如需 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 開發人員指南*》中的 [Detect 命令](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 IoT 主控台中找到憑證的 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 IoT 開發人員指南*》中的 [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 開發人員指南*》中的 [Audit 命令](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 IoT 主控台中找到憑證的 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
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《*AWS IoT API 參考*》中的 [ClearDefaultAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_ClearDefaultAuthorizer.html)。  
+  如需 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"
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [CreateAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateAuthorizer.html)。  
+  如需 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 IoT 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 開發人員指南*》中的 [Detect 命令](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`範例會建立將 JSON 文件傳送至`MyRaspberryPi`裝置的 Simple AWS IoT 任務。  

```
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" --targets "arn:aws:iot:us-west-2:123456789012:thinggroup/DeadBulbs" --document file://example-job.json --description "example continuous job" --target-selection CONTINUOUS  
輸出：  

```
{
    "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 IoT 為此憑證提供私有金鑰的唯一時間，請務必將其保存在安全的位置。  

```
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 IoT 開發人員指南中的建立和註冊 物聯網裝置憑證](https://docs.aws.amazon.com/iot/latest/developerguide/device-certs-create.html)。 **AWS IoT **  
+  如需 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 IoT 開發人員指南*》中的 [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**  
**建立 OTA 更新以和 Amazon FreeRTOS 搭配使用**  
下列`create-ota-update`範例會在物件或群組的目標群組上建立 AWS IoT OTAUpdate。這是 Amazon FreeRTOS over-the-air 更新的一部分，其可讓您將新的韌體映像部署到單一裝置，或一組裝置。  

```
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 參考》**中的 [CreateOTAUpdate](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 IoT 政策**  
下列`create-policy`範例會建立名為 TemperatureSensorPolicy 的 AWS IoT 政策。`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"
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [CreateRoleAlias](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateRoleAlias.html)。  
+  如需 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 開發人員指南*》中的 [Audit 命令](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 開發人員指南*》中的 [Detect 命令](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"
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [CreateStream](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateStream.html)。  
+  如需 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 IoT 開發人員指南*》中的[如何使用登錄檔管理物件](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 IoT 開發人員指南中的建立 IoT 規則](https://docs.aws.amazon.com/iot/latest/developerguide/iot-create-rule.html)。 *AWS IoT *  
+  如需 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 開發人員指南*》中的 [Audit 命令](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
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《*AWS IoT 開發人員指南*》中的 [DeleteAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteAuthorizer.html)。  
+  如需 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 參考》**中的 [DeleteCACertificate](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
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [DeleteCertificate](https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteCertificate.html)。  
+  如需 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 開發人員指南*》中的 [Detect 命令](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 IoT 開發人員指南*》中的 [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 參考》**中的 [DeleteOTAUpdate](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`範例會從您的帳戶刪除指定政策的第 2 版 AWS 。  

```
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**  
**刪除您的註冊 cod**  
下列`delete-registration-code`範例會刪除 an AWS IoT 帳戶特定的註冊碼。  

```
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**  
**刪除 an AWS IoT 角色別名**  
下列`delete-role-alias`範例會刪除名為 的 AWS IoT 角色別名`LightBulbRole`。  

```
aws iot delete-role-alias \
    --role-alias LightBulbRole
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 *AWS IoT 開發人員指南*中的[授權直接呼叫 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 開發人員指南*》中的 [Audit 命令](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 開發人員指南*》中的 [Detect 命令](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
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [DeleteStream](https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteStream.html)。  
+  如需 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 delete-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 IoT 開發人員指南*》中的[刪除規則](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 命令參考》**中的 [DeleteV2LoggingLevel](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`範例列出 IoT 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 開發人員指南*》中的 [Audit 命令](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 開發人員指南*》中的[檢查稽核結果 (Audit 命令)](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 IoT 開發人員指南*》中的 [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`範例取得 an 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 開發人員指南*》中的 [Audit 命令](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
    }
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [DescribeAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeAuthorizer.html)。  
+  如需 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 參考》**中的 [DescribeCACertificate](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
        }
    }
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [DescribeCertificate](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeCertificate.html)。  
+  如需 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"
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [DescribeDefaultAuthorizer](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeDefautAuthorizer.html)。  
+  如需 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 開發人員指南*》中的 [Detect 命令](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"
}
```
如需詳細資訊，請參閱《AWS IoT 開發人員指南》**中的 [DescribeEndpoint](https://docs.aws.amazon.com/iot/latest/developerguide/iot-commands.html#api-iot-DescribeEndpoint)。  
**範例 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"
}
```
如需詳細資訊，請參閱 *AWS IoT 開發人員指南*中的 [X.509 Certificates and AWS IoT](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 IoT 開發人員指南》**中的[管理物件索引](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 IoT 開發人員指南*》中的 [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**  
**取得 an 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
    }
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [DescribeRoleAlias](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeRoleAlias.html)。  
+  如需 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 開發人員指南*》中的 [Audit 命令](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 開發人員指南*》中的 [Detect 命令](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"
    }
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [DescribeStream](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeStream.html)。  
+  如需 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 describe-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：從物件群組分離 an AWS IoT 政策**  
下列 `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：從裝置憑證分離 an AWS IoT 政策**  
下列 `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 開發人員指南*》中的 [Detect 命令](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**  
**將憑證/主體從物件分開**  
下列 `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 IoT 開發人員指南*》中的 [GetBehaviorModelTrainingSummaries (Detect 命令)](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
}
```
如需詳細資訊，請參閱《*AWS IoT 開發人員指南*》中的查詢彙總資料<https://docs.aws.amazon.com/iot/latest/developerguide/index-aggregate.html>。  
+  如需 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 IoT 機群索引的目前組態資料。  

```
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 參考*》中的 [GetOTAUpdate](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% 的溫度值低於 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`範例列出 AWS IoT 目前的記錄選項。  

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

```
{
    "roleArn": "arn:aws:iam::094249569039:role/service-role/iotLoggingRole",
    "defaultLogLevel": "WARN",
    "disableAllLogs": false
}
```
如需詳細資訊，請參閱《*AWS IoT 開發人員指南*》中的標題。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetV2LoggingOptions](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 的 AWS IoT 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 開發人員指南*》中的 [Audit 命令](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**  
**列出稽核緩解動作執行的詳細資訊**  
稽核緩解動作任務會將緩解動作套用至來自 an 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 IoT 開發人員指南*》中的 [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 IoT 開發人員指南*》中的 [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 開發人員指南*》中的 [Audit 命令](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"
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [ListAuthorizers](https://docs.aws.amazon.com/iot/latest/apireference/API_ListAuthorizers.html)。  
+  如需 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 IoT 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 開發人員指南*》中的 [Detect 命令](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 IoT 開發人員指南》**中的[管理物件索引](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`範例列出您 AWS 帳戶中任務的所有任務執行，由 jobId 指定。  

```
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 IoT 開發人員指南*》中的 [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 IoT 開發人員指南*》中的 [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 參考》**中的 [ListOTAUpdates](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
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [ListOutgoingCertificates](https://docs.aws.amazon.com/iot/latest/apireference/API_ListOutgoingCertificates.html)。  
+  如需 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"
    ]
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [ListPrincipalThings](https://docs.aws.amazon.com/iot/latest/apireference/API_ListPrincipleThings.html)。  
+  如需 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"
    ]
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [ListRoleAliases](https://docs.aws.amazon.com/iot/latest/apireference/API_ListRoleAliases.html)。  
+  如需 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 開發人員指南*》中的 [Audit 命令](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 開發人員指南*》中的 [Detect 命令](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 開發人員指南*》中的 [Detect 命令](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."
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT API 參考》**中的 [ListStreams](https://docs.aws.amazon.com/iot/latest/apireference/API_ListStreams.html)。  
+  如需 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 IoT 開發人員指南中的標記您的 IoT 資源](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot.html)。 *AWS IoT *  
+  如需 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 開發人員指南*》中的 [Detect 命令](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 命令參考》**中的 [ListV2LoggingLevels](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`範例列出在 2019 年 6 月 5 日至 2019 年 6 月 12 日期間，針對目前 AWS 帳戶和 AWS 區域的 all AWS IoT Device Defender 安全性描述檔所發生的違規。  

```
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 開發人員指南*》中的 [Detect 命令](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 參考*》中的 [RegisterCACertificate](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 IoT 開發人員指南*》中的物件群組 <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 IoT 開發人員指南中的建立 IoT 規則](https://docs.aws.amazon.com/iot/latest/developerguide/iot-create-rule.html)。 *AWS IoT *  
+  如需 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 IoT 開發人員指南》**中的[管理物件索引](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` 範例會將名為 `2` 之政策的預設版本設定為 `UpdateDeviceCertPolicy`。  

```
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 命令參考》**中的 [SetV2LoggingLevel](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 命令參考》**中的 [SetV2LoggingOptions](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 IoT 開發人員指南*》中的 [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 開發人員指南*》中的 [Audit 命令](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 IoT 開發人員指南中的標記您的 IoT 資源](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot.html)。 *AWS IoT *  
+  如需 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 IoT 政策**  
下列`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 IoT 開發人員指南中的標記您的 IoT 資源](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot.html)。 *AWS IoT *  
+  如需 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 開發人員指南*》中的 [Audit 命令](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 參考》**中的 [UpdateCACertificate](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 IoT 開發人員指南》**中的[管理物件索引](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 IoT 開發人員指南*》中的 [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`範例會變更 an 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 開發人員指南*》中的 [Audit 命令](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`範例會更新 an 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 開發人員指南*》中的 [Detect 命令](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` 範例會更新現有的串流。串流版本增加一版。  

```
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` 範例會從名為 `DeadBulbs` 的群組中移除名為 `MyLightBulb` 的物件，同時將其新增至名為 `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 IoT 開發人員指南*》中的[物件類型](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`範例會驗證 an 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`範例會驗證一組行為，其中包含 an 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 開發人員指南*》中的 [Detect 命令](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)。