

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

# 使用自訂工作區
<a name="tm-sw-custom-ws"></a>

請先檢閱這些先決條件，再開啟資產同步。

## 先決條件
<a name="tm-sw-asset-sync-use-prereqs"></a>

使用 之前 AWS IoT SiteWise，必須先完成下列項目：
+ 您有一個 AWS IoT TwinMaker 工作區。
+ 您在 中有資產和資產模型 AWS IoT SiteWise。如需詳細資訊，請參閱[建立資產模型](https://docs.aws.amazon.com//iot-sitewise/latest/userguide/create-asset-models.html)。
+ 具有下列 AWS IoT SiteWise 動作讀取許可的現有 IAM 角色：
  + `ListAssets`
  + `ListAssetModels`
  +  `DescribeAsset`
  + `DescribeAssetModel`
+ IAM 角色必須具有下列 的寫入許可 AWS IoT TwinMaker：
  + `CreateEntity`
  + `UpdateEntity`
  + `DeleteEntity`
  + `CreateComponentType`
  + `UpdateComponentType`
  + `DeleteComponentType`
  + `ListEntities`
  + `GetEntity`
  + `ListComponentTypes`

  使用下列 IAM 角色做為所需角色的範本：

  ```
                              
  // trust relationships
   {
      {
          "Version": "2012-10-17",		 	 	 
          "Statement": [
          {
              "Effect": "Allow",
              "Principal": {
              "Service": [
              "iottwinmaker.amazonaws.com"
              ]
          },
              "Action": "sts:AssumeRole"
          }
      ]
  }
  
  // permissions - replace ACCOUNT_ID, REGION, WORKSPACE_ID with actual values
  {
      "Version": "2012-10-17",		 	 	 
      "Statement": [{
              "Sid": "SiteWiseAssetReadAccess",
              "Effect": "Allow",
              "Action": [
                  "iotsitewise:DescribeAsset"
              ],
              "Resource": [
                  "arn:aws:iotsitewise:REGION:ACCOUNT_ID:asset/*"
              ]
          },
          {
              "Sid": "SiteWiseAssetModelReadAccess",
              "Effect": "Allow",
              "Action": [
                  "iotsitewise:DescribeAssetModel"
              ],
              "Resource": [
                  "arn:aws:iotsitewise:REGION:ACCOUNT_ID:asset-model/*"
              ]
          },
          {
              "Sid": "SiteWiseAssetModelAndAssetListAccess",
              "Effect": "Allow",
              "Action": [
                  "iotsitewise:ListAssets",
                  "iotsitewise:ListAssetModels"
              ],
              "Resource": [
                  "*"
              ]
          },
          {
              "Sid": "TwinMakerAccess",
              "Effect": "Allow",
              "Action": [
                  "iottwinmaker:GetEntity",
                  "iottwinmaker:CreateEntity",
                  "iottwinmaker:UpdateEntity",
                  "iottwinmaker:DeleteEntity",
                  "iottwinmaker:ListEntities",
                  "iottwinmaker:GetComponentType",
                  "iottwinmaker:CreateComponentType",
                  "iottwinmaker:UpdateComponentType",
                  "iottwinmaker:DeleteComponentType",
                  "iottwinmaker:ListComponentTypes"
              ],
              "Resource": [
                  "arn:aws:iottwinmaker:REGION:ACCOUNT_ID:workspace/WORKSPACE_ID",
                  "arn:aws:iottwinmaker:REGION:ACCOUNT_ID:workspace/WORKSPACE_ID/*"          
              ]
          }
      ]
  }
  ```

使用下列程序來開啟和設定 AWS IoT SiteWise 資產同步。

1. 在 [AWS IoT TwinMaker 主控台](https://console.aws.amazon.com/iottwinmaker/)中，導覽至**設定**頁面。

1. 開啟**模型來源**索引標籤。  
![\[開啟模型來源索引標籤的 AWS IoT TwinMaker 主控台設定頁面。\]](http://docs.aws.amazon.com/zh_tw/iot-twinmaker/latest/guide/images/asset-sync-settings.png)

1. 選擇**連線工作區**，將您的 AWS IoT TwinMaker 工作區連結至您的 AWS IoT SiteWise 資產。
**注意**  
您只能搭配單一 AWS IoT TwinMaker 工作區使用資產同步。如果您想要在不同工作區中同步，您必須中斷同步與某個工作區的連線，並連線至另一個工作區。

1. 接著，導覽至您要在其中使用資產同步的工作區。

1. 選擇 **Add sources (新增來源)**。這會開啟**新增實體模型來源**頁面。  
![\[新增實體模型來源頁面。\]](http://docs.aws.amazon.com/zh_tw/iot-twinmaker/latest/guide/images/add-model-source.png)

1. 在**新增實體模型來源**頁面上，確認來源欄位顯示 **AWS IoT SiteWise**。選取您建立做為 IAM 角色先決條件的 **IAM 角色**。

1. 您現在已開啟 AWS IoT SiteWise 資產同步。您應該會在選取的**工作區**頁面頂端看到合規橫幅，確認資產同步處於作用中狀態。您也應該會在**實體模型來源區段中看到列出的同步來源**。  
![\[工作區頁面顯示實體模型來源的清單。\]](http://docs.aws.amazon.com/zh_tw/iot-twinmaker/latest/guide/images/success-sync.png)