

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

# AWS IoT TwinMaker 和介面 VPC 端點 (AWS PrivateLink)
<a name="vpc-interface-endpoints"></a>

您可以在虛擬私有雲端 (VPC) 與 之間建立私有連線， AWS IoT TwinMaker 方法是建立*介面 VPC 端點*。界面端點採用 技術[AWS PrivateLink](https://aws.amazon.com/privatelink)，可讓您在沒有網際網路閘道、網路位址轉譯 (NAT) 裝置、VPN 連線或 AWS Direct Connect 連線的情況下，私下存取 AWS IoT TwinMaker APIs。 透過其界面端點 AWS IoT TwinMaker 支援 IPv4 和 IPv6 （雙堆疊）。VPC 中的執行個體不需要公有 IP 地址即可與 AWS IoT TwinMaker APIs通訊。VPC 與 之間的流量 AWS IoT TwinMaker 不會離開 Amazon 網路。

每個介面端點都是由您子網路中的一或多個[彈性網路介面](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html)表示。

如需詳細資訊，請參閱《*Amazon* [VPC 使用者指南》中的界面 VPC 端點 (AWS PrivateLink)](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html)。

## AWS IoT TwinMaker VPC 端點的考量事項
<a name="vpc-endpoint-considerations"></a>

設定介面 VPC 端點之前 AWS IoT TwinMaker，請檢閱《*Amazon VPC 使用者指南*》中的[介面端點屬性和限制](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#vpce-interface-limitations)。

AWS IoT TwinMaker 支援從您的 VPC 呼叫其所有 API 動作。
+ 對於資料平面 API 操作，請使用下列端點：

  ```
  data.iottwinmaker.{{region}}.amazonaws.com
  ```

  資料平面 API 操作包括下列項目：
  + [GetPropertyValue](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_GetPropertyValue.html)
  + [GetPropertyValueHistory](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_GetPropertyValueHistory.html)
  + [BatchPutPropertyValues](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_BatchPutPropertyValues.html)
+ 對於控制平面 API 操作，請使用下列端點：

  ```
  api.iottwinmaker.{{region}}.amazonaws.com
  ```

  支援的控制平面 API 操作包括下列項目：
  + [CreateComponentType](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_CreateComponentType.html)
  + [CreateEntity](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_CreateEntity.html)
  + [CreateScene](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_CreateScene.html)
  + [CreateWorkspace](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_CreateWorkspace.html)
  + [DeleteComponentType](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_DeleteComponentType.html)
  + [DeleteEntity](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_DeleteEntity.html)
  + [DeleteScene](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_DeleteScene.html)
  + [DeleteWorkspace](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_DeleteWorkspace.html)
  + [GetComponentType](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_GetComponentType.html)
  + [GetEntity](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_GetEntity.html)
  + [GetScene](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_GetScene.html)
  + [GetWorkspace](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_GetWorkspace.html)
  + [ListComponentTypes](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_ListComponentTypes.html)
  + [ListComponentTypes](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_ListComponentTypes.html)
  + [ListEntities](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_ListEntities.html)
  + [ListScenes](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_ListScenes.html)
  + [ListTagsForResource](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_ListTagsForResource.html)
  + [ListWorkspaces](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_ListWorkspaces.html)
  + [TagResource](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_TagResource.html)
  + [UntagResource](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_UntagResource.html)
  + [UpdateComponentType](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_UpdateComponentType.html)
  + [UpdateEntity](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_UpdateEntity.html)
  + [UpdateScene](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_UpdateScene.html)
  + [UpdateWorkspace](https://docs.aws.amazon.com//iot-twinmaker/latest/apireference/API_UpdateWorkspace.html)

## 建立 的介面 VPC 端點 AWS IoT TwinMaker
<a name="vpc-endpoint-create"></a>

您可以使用 Amazon VPC 主控台或 AWS Command Line Interface () 來建立 AWS IoT TwinMaker 服務的 VPC 端點AWS CLI。如需詳細資訊，請參閱《Amazon VPC 使用者指南》**中的[建立介面端點](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#create-interface-endpoint)。

建立使用下列服務名稱 AWS IoT TwinMaker 的 VPC 端點。
+ 對於資料平面 API 操作，請使用下列服務名稱：

  ```
  com.amazonaws.{{region}}.iottwinmaker.data
  ```
+ 對於控制平面 API 操作，請使用下列服務名稱：

  ```
  com.amazonaws.{{region}}.iottwinmaker.api
  ```

如果您為端點啟用私有 DNS，您可以使用 AWS IoT TwinMaker 區域的預設 DNS 名稱向 提出 API 請求，例如 `iottwinmaker.us-east-1.amazonaws.com`。

如需詳細資訊，請參閱《Amazon VPC 使用者指南》**中的[透過介面端點存取服務](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#access-service-though-endpoint)。

下列區域支援AWS IoT TwinMaker PrivateLink：
+ **us-east-1**

  下列可用區域支援 ControlPlane 服務：`use1-az1`、 `use1-az2`和 `use1-az6`。

  下列可用區域支援 DataPlane 服務：`use1-az1`、 `use1-az2`和 `use1-az4`。
+ **us-west-2**

  下列可用區域支援 ControlPlane 和 DataPlane 服務：`usw2-az1`、 `usw2-az2`和 `usw2-az3`。
+ **eu-west-1**
+ **eu-central-1**
+ **ap-southeast-1**
+ **ap-southeast-2**

如需可用區域的詳細資訊，請參閱 [AWS 資源 - AWS Resource Access Manager 的可用區域 IDs](https://docs.aws.amazon.com/ram/latest/userguide/working-with-az-ids.html)。

## AWS IoT TwinMaker 透過界面 VPC 端點存取
<a name="vpc-endpoint-access"></a>

當您建立介面端點時， AWS IoT TwinMaker 會產生端點特定的 DNS 主機名稱，供您用來與之通訊 AWS IoT TwinMaker。預設會啟用私有 DNS 選項。如需詳細資訊，請參閱《*Amazon VPC 使用者指南*》中的[使用私有託管區域](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-private-hosted-zones)。

如果您為端點啟用私有 DNS，您可以透過下列其中一個 VPC 端點向 AWS IoT TwinMaker 提出 API 請求。
+ 對於資料平面 API 操作，請使用下列端點。將 AWS {{區域}}取代為您的區域。

  ```
  data.iottwinmaker.{{region}}.amazonaws.com
  ```
+ 對於控制平面 API 操作，請使用下列端點。將 AWS {{區域}}取代為您的區域。

  ```
  api.iottwinmaker.{{region}}.amazonaws.com
  ```

如果您停用端點的私有 DNS，您必須執行下列動作，才能透過端點存取 AWS IoT TwinMaker ：
+ 在 API 請求中指定 VPC 端點 URL。
  + 對於資料平面 API 操作，請使用下列端點 URL。將 {{vpc-endpoint-id}} 和{{區域}}取代為您的 VPC 端點 ID 和區域。

    ```
    {{vpc-endpoint-id}}.data.iottwinmaker.{{region}}.vpce.amazonaws.com
    ```
  + 對於控制平面 API 操作，請使用下列端點 URL。將 {{vpc-endpoint-id}} 和{{區域}}取代為您的 VPC 端點 ID 和區域。

    ```
    {{vpc-endpoint-id}}.api.iottwinmaker.{{region}}.vpce.amazonaws.com
    ```
+ 停用主機字首注入。當您呼叫每個 API 操作時， AWS CLI and AWS SDKs會在服務端點前面加上各種主機字首。當您指定 VPC 端點 AWS IoT TwinMaker 時，這會導致 AWS CLI AWS SDKs 產生無效的 URLs。
**重要**  
您無法在 AWS CLI 或 中停用主機字首注入 AWS Tools for PowerShell。這表示如果您已停用私有 DNS，您將無法 AWS IoT TwinMaker 透過 VPC 端點使用 AWS CLI 或 AWS Tools for PowerShell 存取 。如果您想要使用這些工具 AWS IoT TwinMaker 透過端點存取 ，請啟用私有 DNS。

  如需如何在 SDKs AWS 中停用主機字首注入的詳細資訊，請參閱每個 SDK 的下列文件章節：
  + [適用於 C\+\+ 的 AWS SDK](https://sdk.amazonaws.com/cpp/api/LATEST/struct_aws_1_1_client_1_1_client_configuration.html#a3579c1a2f2e1c9d54e99c59d27643499)
  + [適用於 Go 的 AWS SDK](https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config.WithDisableEndpointHostPrefix)
  + [適用於 Go 的 AWS SDK](https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-endpoints.html#migration) v2
  + [適用於 Java 的 AWS SDK](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ClientConfiguration.html#setDisableHostPrefixInjection-boolean-)
  + [AWS SDK for Java 2.x](https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/core/client/config/SdkAdvancedClientOption.html)
  + [適用於 JavaScript 的 AWS SDK](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#hostPrefixEnabled-property)
  + [適用於 .NET 的 AWS SDK](https://docs.aws.amazon.com/sdkfornet/v4/apidocs/items/Runtime/TClientConfig.html)
  + [適用於 PHP 的 AWS SDK](https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.AwsClient.html#___construct)
  + [適用於 Python (Boto3) 的 AWS SDK](https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html)
  + [適用於 Ruby 的 AWS SDK](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/IoTSiteWise/Client.html#initialize-instance_method)

如需詳細資訊，請參閱《Amazon VPC 使用者指南》**中的[透過介面端點存取服務](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#access-service-though-endpoint)。

## 為 建立 VPC 端點政策 AWS IoT TwinMaker
<a name="vpc-endpoint-policy"></a>

您可以將端點政策連接至控制 AWS IoT TwinMaker存取權限的 VPC 端點。此政策會指定下列資訊：
+ 可執行動作的主體。
+ 可執行的動作。
+ 可供執行動作的資源。

如需詳細資訊，請參閱 *Amazon VPC 使用者指南*中的[使用 VPC 端點控制對服務的存取](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints-access.html)。

**範例： AWS IoT TwinMaker 動作的 VPC 端點政策**  
以下是 端點政策的範例 AWS IoT TwinMaker。連接到端點時，此政策會授予 AWS 所有資源`iottwinmakeradmin`帳戶中 IAM 使用者的所列 AWS IoT TwinMaker 動作`123456789012`的存取權。

```
{
   "Statement":[ 
      {
        "Principal": {
            "AWS": "arn:aws:iam::123456789012:user/role"
                },
         "Resource": "*",
         "Effect":"Allow",
         "Action":[
            "{{iottwinmaker}}:{{CreateEntity}}",
            "{{iottwinmaker}}:{{GetScene}}",
            "{{iottwinmaker}}:{{ListEntities}}"
         ]
        }
    ]
}
```