

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

# 將憑證傳輸至另一個帳戶
<a name="transfer-cert"></a>

屬於某個憑證的 X.509 憑證 AWS 帳戶 可以轉移到另一個憑證 AWS 帳戶。

**將 X.509 憑證從一個憑證轉移到 AWS 帳戶 另一個憑證**

1. [開始傳輸憑證](#transfer-cert-init)

   在起始傳輸之前，必須先停用憑證，並將其與所有政策和物件分開。

1. [接受或拒絕憑證傳輸](#transfer-cert-accept)

   接收帳戶必須明確地接受或拒絕傳輸的憑證。在接收帳戶接受憑證之後，必須先啟用憑證才能使用。

1. [取消憑證傳輸](#transfer-cert-cancel)

   如果憑證未被接受，原始帳戶可以取消傳輸。

## 開始傳輸憑證
<a name="transfer-cert-init"></a>

您可以使用 [AWS IoT 主控台](https://console.aws.amazon.com/iot/home)或 ，開始 AWS 帳戶 將憑證轉移到另一個憑證 AWS CLI。

### 開始傳輸憑證 (主控台)
<a name="transfer-cert-init-console"></a>

若要完成此程序，將需要您想要傳輸之憑證的 ID。

從具有要傳輸之憑證的帳戶執行此程序。

**開始將憑證轉移到另一個憑證 AWS 帳戶**

1. 登入 AWS 管理主控台並開啟[AWS IoT 主控台](https://console.aws.amazon.com/iot/home)。

1. 在左側導覽窗格中，選擇 **Secure (安全)**，然後選擇 **Certificates (憑證)**。

   選擇您想要傳輸且狀態為 **Active** (作用中) 或 **Inactive** (非作用中) 的憑證，並開啟其詳細資訊頁面。

1. 在憑證 **Details** (詳細資訊) 頁面的 **Actions** (動作) 選單中，如果 **Deactivate** (停用) 選項可用，請選擇 **Deactivate** (停用) 選項來停用憑證。

1. 在憑證的 **Details** (詳細資訊) 頁面的左側選單中，選擇 **Policies** (政策)。

1. 在憑證的 **Policies** (政策) 頁面上，如果有任何政策連接至憑證，請開啟政策的選項選單並選擇 **Detach** (分開)，來分開每個政策。

   在您繼續之前，憑證不得有任何連接的政策。

1. 在憑證的 **Policies** (政策) 頁面的左側選單中，選擇 **Things** (物件)。

1. 在憑證的 **Things** (物件) 頁面上，如果有任何物件連接至憑證，請開啟物件的選項選單並選擇 **Detach** (分開)，來分開每個物件。

   在您繼續之前，憑證不得有任何連接的物件。

1. 在憑證的 **Things** (物件) 頁面的左側選單中，選擇 **Details** (詳細資訊)。

1. 在憑證的 **Details** (詳細資訊) 頁面的 **Actions** (動作) 選單中，選擇 **Start transfer** (開始傳輸) 以開啟 **Start transfer** (開始傳輸) 對話方塊。

1. 在**開始轉移**對話方塊中，輸入要接收憑證的帳戶 AWS 帳戶 號碼，以及選用的簡短訊息。

1. 選擇 **Start transfer** (開始傳輸) 以傳輸憑證。

主控台應該會顯示訊息，指出傳輸成功或失敗。如果傳輸已開始，則憑證的狀態會更新為 **Transferred** (已傳輸)。

### 開始傳輸憑證 (CLI)
<a name="transfer-cert-init-cli"></a>

若要完成此程序，將需要您想要傳輸之憑證的 *certificateId* 和 *certificateArn*。

從具有要傳輸之憑證的帳戶執行此程序。

**開始將憑證轉移到另一個 AWS 帳戶**

1. 使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-certificate.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/update-certificate.html) 命令來停用憑證

   ```
   aws iot update-certificate --certificate-id certificateId --new-status INACTIVE
   ```

1. 分開所有策略。

   1. 使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-attached-policies.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-attached-policies.html) 命令來列出已連接至憑證的政策。

      ```
      aws iot list-attached-policies --target certificateArn
      ```

   1. 對於每個連接的政策，使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/detach-policy.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/detach-policy.html) 命令來分開政策。

      ```
      aws iot detach-policy --target certificateArn --policy-name policy-name
      ```

1. 分開所有物件。

   1. 使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-principal-things.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-principal-things.html) 命令來列出已連接至憑證的物件。

      ```
      aws iot list-principal-things --principal certificateArn
      ```

   1. 對於每個連接的物件，使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/detach-thing-principal.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/detach-thing-principal.html) 命令來分開物件。

      ```
      aws iot detach-thing-principal --principal certificateArn --thing-name thing-name
      ```

1. 使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/transfer-certificate.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/transfer-certificate.html) 命令來啟動憑證傳輸。

   ```
   aws iot transfer-certificate --certificate-id certificateId --target-aws-account account-id
   ```

## 接受或拒絕憑證傳輸
<a name="transfer-cert-accept"></a>

您可以使用 [AWS IoT 主控台](https://console.aws.amazon.com/iot/home)或 AWS 帳戶 ，接受或拒絕從另一個 傳輸給您 AWS 帳戶 的憑證 AWS CLI。

### 接受或拒絕憑證傳輸 (主控台)
<a name="transfer-cert-accept-console"></a>

若要完成此程序，將需要已傳輸至您帳戶之憑證的 ID。

從接收所傳輸憑證的帳戶執行此程序。

**接受或拒絕已傳輸至 的憑證 AWS 帳戶**

1. 登入 AWS 管理主控台並開啟[AWS IoT 主控台](https://console.aws.amazon.com/iot/home)。

1. 在左側導覽窗格中，選擇 **Secure (安全)**，然後選擇 **Certificates (憑證)**。

   選擇您想要接受或拒絕且狀態為 **Pending transfer** (待定傳輸) 的憑證，並開啟其詳細資訊頁面。

1. 在憑證的 **Details** (詳細資訊) 頁面的 **Actions** (動作) 選單中，
   + 若要接受憑證，請選擇 **Accept transfer** (接受傳輸)。
   + 若不要接受憑證，請選擇 **Reject transfer** (拒絕傳輸)。

### 接受或拒絕憑證傳輸 (CLI)
<a name="transfer-cert-accept-cli"></a>

若要完成此程序，將需要您想要接受或拒絕之憑證傳輸的 *certificateId*。

從接收所傳輸憑證的帳戶執行此程序。

**接受或拒絕已傳輸至 的憑證 AWS 帳戶**

1. 使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/accept-certificate-transfer.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/accept-certificate-transfer.html) 命令來接受憑證。

   ```
   aws iot accept-certificate-transfer --certificate-id certificateId
   ```

1. 使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/reject-certificate-transfer.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/reject-certificate-transfer.html) 命令來拒絕憑證。

   ```
   aws iot reject-certificate-transfer --certificate-id certificateId
   ```

## 取消憑證傳輸
<a name="transfer-cert-cancel"></a>

您可以在接受憑證傳輸之前，使用 [AWS IoT 主控台](https://console.aws.amazon.com/iot/home)或 AWS CLI來取消憑證傳輸。

### 取消憑證傳輸 (主控台)
<a name="transfer-cert-cancel-console"></a>

若要完成此程序，將需要您想要取消之憑證傳輸的 ID。

從已起始憑證傳輸的帳戶執行此程序。

**取消憑證傳輸**

1. 登入 AWS 管理主控台並開啟 [AWS IoT 主控台](https://console.aws.amazon.com/iot/home)。

1. 在左側導覽窗格中，選擇 **Secure (安全)**，然後選擇 **Certificates (憑證)**。

   選擇您想要取消其傳輸且狀態為 **Transferred** (已傳輸) 的憑證，並開啟其選項選單。

1. 在憑證的選項選單上，選擇 **Revoke transfer** (撤銷傳輸) 選項來取消憑證傳輸。
**重要**  
請小心不要弄錯 **Revoke transfer** (撤銷傳輸) 選項與 **Revoke** (撤銷) 選項。  
**Revoke transfer** (撤銷傳輸) 選項會取消憑證傳輸，而 **Revoke** (撤銷) 選項會使 AWS IoT無法復原且無法使用憑證。

### 取消憑證傳輸 (CLI)
<a name="transfer-cert-cancel-cli"></a>

若要完成此程序，將需要您想要取消之憑證傳輸的 *certificateId*。

從已起始憑證傳輸的帳戶執行此程序。

使用 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/cancel-certificate-transfer.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/cancel-certificate-transfer.html) 命令來取消憑證傳輸。

```
aws iot cancel-certificate-transfer --certificate-id certificateId
```