

# Amazon IoT TwinMaker and interface VPC endpoints (Amazon PrivateLink)
<a name="vpc-interface-endpoints"></a>

You can establish a private connection between your virtual private cloud (VPC) and Amazon IoT TwinMaker by creating an *interface VPC endpoint*. Interface endpoints are powered by [Amazon PrivateLink](https://www.amazonaws.cn/privatelink), which you can use to privately access Amazon IoT TwinMaker APIs without an internet gateway, network address translation (NAT) device, VPN connection, or Amazon Direct Connect connection. Amazon IoT TwinMaker supports both IPv4 and IPv6 (dual-stack) through its interface endpoints. Instances in your VPC don't need public IP addresses to communicate with Amazon IoT TwinMaker APIs. Traffic between your VPC and Amazon IoT TwinMaker doesn't leave the Amazon network. 

Each interface endpoint is represented by one or more [Elastic Network Interfaces](https://docs.amazonaws.cn/AWSEC2/latest/UserGuide/using-eni.html) in your subnets. 

For more information, see [Interface VPC endpoints (Amazon PrivateLink)](https://docs.amazonaws.cn/vpc/latest/userguide/vpce-interface.html) in the *Amazon VPC User Guide*.

## Considerations for Amazon IoT TwinMaker VPC endpoints
<a name="vpc-endpoint-considerations"></a>

Before you set up an interface VPC endpoint for Amazon IoT TwinMaker, review [Interface endpoint properties and limitations](https://docs.amazonaws.cn/vpc/latest/userguide/vpce-interface.html#vpce-interface-limitations) in the *Amazon VPC User Guide*.

Amazon IoT TwinMaker supports making calls to all of its API actions from your VPC.
+ For data plane API operations, use the following endpoint:

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

  The data plane API operations include the following:
  + [GetPropertyValue](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_GetPropertyValue.html)
  + [GetPropertyValueHistory](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_GetPropertyValueHistory.html)
  + [BatchPutPropertyValues](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_BatchPutPropertyValues.html)
+ For the control plane API operations, use the following endpoint:

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

  The supported control plane API operations include the following:
  + [CreateComponentType](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_CreateComponentType.html)
  + [CreateEntity](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_CreateEntity.html)
  + [CreateScene](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_CreateScene.html)
  + [CreateWorkspace](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_CreateWorkspace.html)
  + [DeleteComponentType](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_DeleteComponentType.html)
  + [DeleteEntity](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_DeleteEntity.html)
  + [DeleteScene](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_DeleteScene.html)
  + [DeleteWorkspace](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_DeleteWorkspace.html)
  + [GetComponentType](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_GetComponentType.html)
  + [GetEntity](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_GetEntity.html)
  + [GetScene](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_GetScene.html)
  + [GetWorkspace](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_GetWorkspace.html)
  + [ListComponentTypes](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_ListComponentTypes.html)
  + [ListComponentTypes](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_ListComponentTypes.html)
  + [ListEntities](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_ListEntities.html)
  + [ListScenes](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_ListScenes.html)
  + [ListTagsForResource](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_ListTagsForResource.html)
  + [ListWorkspaces](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_ListWorkspaces.html)
  + [TagResource](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_TagResource.html)
  + [UntagResource](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_UntagResource.html)
  + [UpdateComponentType](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_UpdateComponentType.html)
  + [UpdateEntity](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_UpdateEntity.html)
  + [UpdateScene](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_UpdateScene.html)
  + [UpdateWorkspace](https://docs.amazonaws.cn//iot-twinmaker/latest/apireference/API_UpdateWorkspace.html)

## Creating an interface VPC endpoint for Amazon IoT TwinMaker
<a name="vpc-endpoint-create"></a>

You can create a VPC endpoint for the Amazon IoT TwinMaker service by using either the Amazon VPC console or the Amazon Command Line Interface (Amazon CLI). For more information, see [Creating an interface endpoint](https://docs.amazonaws.cn/vpc/latest/userguide/vpce-interface.html#create-interface-endpoint) in the *Amazon VPC User Guide*.

Create a VPC endpoint for Amazon IoT TwinMaker that uses the following service name. 
+ For data plane API operations, use the following service name: 

  ```
  com.amazonaws.{{region}}.iottwinmaker.data
  ```
+ For control plane API operations, use the following service name: 

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

If you enable private DNS for the endpoint, you can make API requests to Amazon IoT TwinMaker by using its default DNS name for the Region, for example, `iottwinmaker.us-east-1.amazonaws.com`. 

For more information, see [Accessing a service through an interface endpoint](https://docs.amazonaws.cn/vpc/latest/userguide/vpce-interface.html#access-service-though-endpoint) in the *Amazon VPC User Guide*.

Amazon IoT TwinMaker PrivateLink is supported in the following regions:
+ **us-east-1**

  The ControlPlane service is supported in the following availability zones: `use1-az1`, `use1-az2`, and `use1-az6`.

  The DataPlane service is supported in the following availability zones: `use1-az1`, `use1-az2`, and `use1-az4`.
+ **us-west-2**

  The ControlPlane and DataPlane services are supported in the following availability zones: `usw2-az1`, `usw2-az2`, and `usw2-az3`. 
+ **eu-west-1**
+ **eu-central-1**
+ **ap-southeast-1**
+ **ap-southeast-2**

For more information on availability zones, see [Availability Zone IDs for your Amazon resources - Amazon Resource Access Manager](https://docs.amazonaws.cn/ram/latest/userguide/working-with-az-ids.html).

## Accessing Amazon IoT TwinMaker through an interface VPC endpoint
<a name="vpc-endpoint-access"></a>

When you create an interface endpoint, Amazon IoT TwinMaker generates endpoint-specific DNS hostnames that you can use to communicate with Amazon IoT TwinMaker. The private DNS option is enabled by default. For more information, see [Using private hosted zones](https://docs.amazonaws.cn/vpc/latest/userguide/vpc-dns.html#vpc-private-hosted-zones) in the *Amazon VPC User Guide*.

If you enable private DNS for the endpoint, you can make API requests to Amazon IoT TwinMaker through one of the following VPC endpoints.
+ For the data plane API operations, use the following endpoint. 

  ```
  data.iottwinmaker.cn-north-1.amazonaws.com.cn
  ```
+ For the control plane API operations, use the following endpoint. 

  ```
  data.iottwinmaker.cn-north-1.amazonaws.com.cn
  ```

If you disable private DNS for the endpoint, you must do the following to access Amazon IoT TwinMaker through the endpoint:
+ Specify the VPC endpoint URL in API requests.
  + For the data plane API operations, use the following endpoint URL. Replace {{vpc-endpoint-id}} with your VPC endpoint ID.

    ```
    {{vpc-endpoint-id}}.data.iottwinmaker.cn-north-1.vpce.amazonaws.com.cn
    ```
  + For the control plane API operations, use the following endpoint URL. Replace {{vpc-endpoint-id}} with your VPC endpoint ID.

    ```
    {{vpc-endpoint-id}}.api.iottwinmaker.cn-north-1.vpce.amazonaws.com.cn
    ```
+ Disable host prefix injection. The Amazon CLI and Amazon SDKs prepend the service endpoint with various host prefixes when you call each API operation. This causes the Amazon CLI and Amazon SDKs to produce invalid URLs for Amazon IoT TwinMaker when you specify a VPC endpoint.
**Important**  
You can't disable host prefix injection in Amazon CLI or Amazon Tools for PowerShell. This means that if you've disabled private DNS, you won't be able to use Amazon CLI or Amazon Tools for PowerShell to access Amazon IoT TwinMaker through the VPC endpoint. If you want to use these tools to access Amazon IoT TwinMaker through the endpoint, enable private DNS.

  For more information about how to disable host prefix injection in the Amazon SDKs, see the following documentation sections for each SDK:
  + [Amazon SDK for C\+\+](https://sdk.amazonaws.com/cpp/api/LATEST/struct_aws_1_1_client_1_1_client_configuration.html#a3579c1a2f2e1c9d54e99c59d27643499)
  + [Amazon SDK for Go](https://docs.amazonaws.cn/sdk-for-go/api/aws/#Config.WithDisableEndpointHostPrefix)
  + [Amazon SDK for Go v2](https://docs.amazonaws.cn/sdk-for-go/v2/developer-guide/configure-endpoints.html#migration)
  + [Amazon SDK for Java](https://docs.amazonaws.cn/AWSJavaSDK/latest/javadoc/com/amazonaws/ClientConfiguration.html#setDisableHostPrefixInjection-boolean-)
  + [Amazon SDK for Java 2.x](https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/core/client/config/SdkAdvancedClientOption.html)
  + [Amazon SDK for JavaScript](https://docs.amazonaws.cn/AWSJavaScriptSDK/latest/AWS/Config.html#hostPrefixEnabled-property)
  + [Amazon SDK for .NET](https://docs.amazonaws.cn/sdkfornet/v4/apidocs/items/Runtime/TClientConfig.html)
  + [Amazon SDK for PHP](https://docs.amazonaws.cn/aws-sdk-php/v3/api/class-Aws.AwsClient.html#___construct)
  + [Amazon SDK for Python (Boto3)](https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html)
  + [Amazon SDK for Ruby](https://docs.amazonaws.cn/sdk-for-ruby/v3/api/Aws/IoTSiteWise/Client.html#initialize-instance_method)

For more information, see [Accessing a service through an interface endpoint](https://docs.amazonaws.cn/vpc/latest/userguide/vpce-interface.html#access-service-though-endpoint) in the *Amazon VPC User Guide*.

## Creating a VPC endpoint policy for Amazon IoT TwinMaker
<a name="vpc-endpoint-policy"></a>

You can attach an endpoint policy to your VPC endpoint that controls access to Amazon IoT TwinMaker. The policy specifies the following information:
+ The principal that can perform actions.
+ The actions that can be performed.
+ The resources on which actions can be performed.

For more information, see [Controlling access to services with VPC endpoints](https://docs.amazonaws.cn/vpc/latest/userguide/vpc-endpoints-access.html) in the *Amazon VPC User Guide*. 

**Example: VPC endpoint policy for Amazon IoT TwinMaker actions**  
The following is an example of an endpoint policy for Amazon IoT TwinMaker. When attached to an endpoint, this policy grants access to the listed Amazon IoT TwinMaker actions for the IAM user `iottwinmakeradmin` in the Amazon account `123456789012` on all resources.

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