

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

# 搭配界面 VPC 端點使用 AWS IoT Device Management 安全通道
<a name="IoTCore-ST-VPC"></a>

AWS IoT Device Management 安全通道支援介面 VPC 端點。您可以使用 VPC 端點來保留 VPC 與 AWS 網路 AWS IoT Secure Tunneling 之間的流量，而不需要網際網路閘道、NAT 裝置、VPN 連線或 AWS Direct Connect 連線。

介面 VPC 端點採用 [AWS PrivateLink](https://docs.aws.amazon.com//vpc/latest/privatelink/what-is-privatelink.html)技術，這項技術可讓您使用私有 IP 地址來私下存取 服務。如需詳細資訊，請參閱《 AWS PrivateLink 指南》中的[使用介面 VPC 端點存取 AWS 服務](https://docs.aws.amazon.com//vpc/latest/privatelink/create-interface-endpoint.html)。

**Topics**
+ [先決條件](#Create-ST-VPC-endpoints-prereq)
+ [透過 VPC 端點接收通道通知](#ST-VPC-Receive-notifications)
+ [建立 VPC 端點以進行安全通道](#Create-ST-VPC-endpoints-Create)
+ [在 Proxy 伺服器上設定 VPC 端點政策](#Create-ST-VPC-endpoints-Configure)
+ [後續步驟](#Create-ST-VPC-endpoints-Next)

## 先決條件
<a name="Create-ST-VPC-endpoints-prereq"></a>

為 建立 VPC 端點之前 AWS IoT Secure Tunneling，請確認您有下列項目：
+ 具有建立 VPC 端點必要許可 AWS 的帳戶。
+ 您 AWS 帳戶中的 VPC。
+ 了解 AWS IoT Device Management 安全通道概念。
+ 熟悉 VPC 端點政策和 AWS Identity and Access Management (IAM)

## 透過 VPC 端點接收通道通知
<a name="ST-VPC-Receive-notifications"></a>

若要透過 VPC 端點接收通道通知，您的裝置可以透過 VPC 端點連線至 AWS IoT Core 資料平面，並訂閱安全通道預留 MQTT 主題。

如需如何在 AWS IoT Core 資料平面中建立和設定 VPC 端點的說明，請參閱《 AWS IoT 開發人員指南》中的[使用 AWS IoT Core 搭配介面 VPC 端點](https://docs.aws.amazon.com/iot/latest/developerguide/IoTCore-VPC.html)。

## 建立 VPC 端點以進行安全通道
<a name="Create-ST-VPC-endpoints-Create"></a>

您可以為安全通道控制平面和代理伺服器建立 VPC 端點。

**建立用於安全通道的 VPC 端點**

1. 請遵循《Amazon VPC 開發人員指南》中的[建立介面端點](https://docs.aws.amazon.com//vpc/latest/privatelink/create-interface-endpoint.html)的步驟

1. 針對**服務名稱**，根據您的端點類型選擇下列其中一個選項：

**控制平面**
   + 標準： `com.amazonaws.<region>.iot.tunneling.api`
   + FIPS （適用於 FIPS 區域）： `com.amazonaws.<region>.iot-fips.tunneling.api`

**代理伺服器**
   + 標準： `com.amazonaws.<region>.iot.tunneling.data`
   + FIPS （適用於 FIPS 區域）： `com.amazonaws.<region>.iot-fips.tunneling.data`

   將 {{<region>}} 取代為您的 AWS 區域。例如 `us-east-1`。

1. 根據您的網路需求，完成 VPC 端點建立程序中剩餘的步驟。

## 在 Proxy 伺服器上設定 VPC 端點政策
<a name="Create-ST-VPC-endpoints-Configure"></a>

除了用來授權通道連線的用戶端存取字符型授權之外，您還可以使用 VPC 端點政策進一步限制裝置如何使用 VPC 端點連線到安全通道 Proxy Server。VPC 端點政策遵循類似 IAM 的語法，並在 VPC 端點本身上設定。

請注意，代理伺服器 VPC 端點政策唯一支援的 IAM 動作是 `iot:ConnectToTunnel`。

以下是不同 VPC 端點政策的範例。

### Proxy 伺服器 VPC 端點政策範例
<a name="w2aac17c35c31c15b9"></a>

下列範例顯示常見使用案例的 Proxy Server VPC 端點政策組態。

**Example - 預設政策**  
此政策允許 VPC 中的裝置連線到任何帳戶中建立 AWS 端點 AWS 區域 之相同 中的任何通道。  

```
{
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "*",
            "Resource": "*"
        }
    ]
}
```

**Example - 限制存取特定 AWS 帳戶**  
此政策允許 VPC 端點僅連線到特定 AWS 帳戶中的通道。  

```
{
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "iot:ConnectToTunnel",
            "Resource": [
                "arn:aws:iot:us-east-1:111122223333:tunnel/*",
                "arn:aws:iot:us-east-1:444455556666:tunnel/*"
            ]
        }
    ]
}
```

**Example - 依通道端點限制連線**  
您可以限制 VPC 端點存取，僅允許裝置連線到通道的來源或目的地端。  
僅限來源：  

```
{
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "iot:ConnectToTunnel",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "iot:ClientMode": "source"
                }
            }
        }
    ]
}
```

僅限目的地：

```
{
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "iot:ConnectToTunnel",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "iot:ClientMode": "destination"
                }
            }
        }
    ]
}
```

**Example - 根據資源標籤限制存取**  
此政策允許 VPC 端點僅連線到以特定鍵值對標記的通道。  

```
{
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "iot:ConnectToTunnel",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/Environment": "Production"
                }
            }
        }
    ]
}
```

**Example - 合併政策條件**  
此政策示範結合多個政策元素。它允許連線到特定 AWS 帳戶中的任何通道，但前提是通道已標記為 `AllowConnectionsThroughPrivateLink`且`true`用戶端未連線到通道的目的地端。  

```
{
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "iot:ConnectToTunnel",
            "Resource": [
                "arn:aws:iot:us-east-1:111122223333:tunnel/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/AllowConnectionsThroughPrivateLink": "true"
                }
            }
        },
        {
            "Effect": "Deny",
            "Principal": "*",
            "Action": "iot:ConnectToTunnel",
            "Resource": [
                "arn:aws:iot:us-east-1:111122223333:tunnel/*"
            ],
            "Condition": {
                "StringEquals": {
                    "iot:ClientMode": "destination"
                }
            }
        }
    ]
}
```

## 後續步驟
<a name="Create-ST-VPC-endpoints-Next"></a>

為 建立和設定 VPC 端點之後 AWS IoT Secure Tunneling，請考慮下列事項：
+ 透過端點連線裝置，以測試您的 VPC 端點組態。
+ 透過 Amazon CloudWatch 指標監控 VPC 端點用量。
+ 根據您的安全需求，視需要檢閱和更新您的 VPC 端點政策。

如需 AWS IoT Device Management 安全通道的詳細資訊，請參閱 [AWS IoT Secure Tunneling](https://docs.aws.amazon.com//iot/latest/developerguide/secure-tunneling.html)。