

要获得与亚马逊 Timestream 类似的功能 LiveAnalytics，可以考虑适用于 InfluxDB 的亚马逊 Timestream。适用于 InfluxDB 的 Amazon Timestream 提供简化的数据摄取和个位数毫秒级的查询响应时间，以实现实时分析。点击[此处](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html)了解更多信息。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# VPC 端点（AWS PrivateLink）
<a name="VPCEndpoints"></a>

您可以通过创建接口 VPC 终端节点在您的 VPC 和 Amazon Timestream 之间建立*私有*连接。 LiveAnalytics 接口端点由一项技术提供支持 [AWS PrivateLink](https://aws.amazon.com/privatelink)，该技术使您 LiveAnalytics APIs 无需互联网网关、NAT 设备、VPN 连接或 Direct Connect 连接即可私密访问 Timest AWS ream。您的 VPC 中的实例不需要公有 IP 地址即可与 Timestream 通信。 LiveAnalytics APIs您的 VPC 和 Timestream 之间的流量 LiveAnalytics不会离开亚马逊网络。

每个接口端点均由子网中的一个或多个[弹性网络接口](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html)表示。有关接口 VPC 终端节点的更多信息，请参阅 *Amazon VPC 用户指南中的接口 VPC* [终端节点 (AWS PrivateLink)](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html)。

为了开始使用适用于 LiveAnalytics 和 VPC 终端节点的 Timestream，我们提供了有关 Timestream 的具体注意事项的信息：使用 LiveAnalytics VPC 终端节点、为 Timestream 创建接口 VPC 终端节点 LiveAnalytics、为 Timestream 创建 VPC 终端节点策略 LiveAnalytics，以及将 Timestream 客户端（用于写入或查询 SDK）与 VPC 终端节点一起使用。

**Topics**
+ [VPC 端点如何使用 Timestream](VPCEndpoints.vpc-endpoint-considerations.md)
+ [为 Timestream 创建接口 VPC 终端节点 LiveAnalytics](VPCEndpoints.vpc-endpoint-create.md)
+ [为 Timestream 创建 VPC 终端节点策略 LiveAnalytics](VPCEndpoints.vpc-endpoint-policy.md)

# VPC 端点如何使用 Timestream
<a name="VPCEndpoints.vpc-endpoint-considerations"></a>

 当您创建 VPC 端点以访问 Timestream 写入或 Timestream 查询 SDK 时，所有请求均路由至 Amazon 网络内的端点，且不会访问公共互联网。更具体而言，您的请求将路由至您账户在特定区域所映射存储单元对应的写入和查询端点。要了解有关 Timestream 的蜂窝架构和蜂窝特定端点的更多信息，请参阅 [蜂窝架构](architecture.md#cells)。例如，假设您的账户已映射到 `us-west-2` 中的 `cell1`，并且您已为写入（`ingest-cell1.timestream.us-west-2.amazonaws.com`）和查询（`query-cell1.timestream.us-west-2.amazonaws.com`）设置 VPC 接口端点。在此情况下，使用这些端点发送的任何写入请求将完全保留在 Amazon 网络中，且不会访问公共互联网。

## Timestream VPC 端点注意事项
<a name="VPCEndpoints.vpc-endpoint-considerations.how-it-works"></a>

为 Timestream 创建 VPC 端点时，请考虑以下注意事项：
+ 在为 Timestream 设置接口 VPC 终端节点之前 LiveAnalytics，请务必查看*亚马逊 VPC 用户指南*中的[接口终端节点属性和限制](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#vpce-interface-limitations)。
+ Timestream for LiveAnalytics 支持从您的 VPC 调用[其所有 API 操作](https://docs.aws.amazon.com/timestream/latest/developerguide/API_Reference.html)。
+ Timestream 支持 VPC 终端节点策略。 LiveAnalytics默认情况下，允许通过终端节点对 Timestream 进行 LiveAnalytics 完全访问权限。有关更多信息，请参阅《Amazon VPC User Guide》**中的 [Controlling access to services with VPC endpoints](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints-access.html)。
+ 由于 Timestream 的架构，访问写入和查询操作需要创建两个 VPC 接口端点，每个 SDK 各对应一个。此外，您必须指定单元格端点（您只能为映射到的 Timestream 单元格创建端点）。详细信息可以在本指南的 “为 [Timestream 创建接口 VPC 终端](VPCEndpoints.vpc-endpoint-create.md)节点 LiveAnalytics” 部分中找到。

既然你已经了解了 Timestream 如何与 VPC 终端节点配合 LiveAnalytics 使用，那就为其[创建一个 Timestream 的接口 VPC 终端节点](VPCEndpoints.vpc-endpoint-create.md)。 LiveAnalytics

# 为 Timestream 创建接口 VPC 终端节点 LiveAnalytics
<a name="VPCEndpoints.vpc-endpoint-create"></a>

您可以使用 Amazon [VPC 控制台或 AWS Command Line Interface (AWS CLI) 为 LiveAnalytics 服务的 Timestream 创建接口 VPC 终端节点](https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-interface.html)。要为 Timestream 创建 VPC 端点，请完成下述 Timestream 特定步骤。

**注意**  
完成以下步骤之前，确保您了解 [Timestream VPC 端点的具体注意事项](VPCEndpoints.vpc-endpoint-considerations.md)。

## 使用 Timestream 单元格构造 VPC 端点服务名称
<a name="VPCEndpoints.vpc-endpoint-create.vpc-endpoint-name"></a>

 由于 Timestream 的架构独特，因此必须为每个 SDK（写入和查询）创建单独的 VPC 接口端点。此外，您必须指定 Timestream 单元格端点（您只能为映射到的 Timestream 单元格创建端点）。要使用接口 VPC 端点从 VPC 内部直接连接到 Timestream，请完成以下步骤：

1. 首先，找到可用的 Timestream 单元格端点。要查找可用的蜂窝终端节点，请使用[`DescribeEndpoints`操作](https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_DescribeEndpoints.html)（可通过 “写入” 和 “查询” APIs）列出您的 Timestream 账户中可用的单元终端节点。有关更多详细信息，请参阅[示例](#VPCEndpoints.vpc-endpoint-create.vpc-endpoint-name.example)。

1. 选择要使用的单元格端点后，请为 Timestream 写入或查询 API 创建 VPC 接口端点字符串：
   + *对于写入 API：*

     ```
     com.amazonaws.<region>.timestream.ingest-<cell>
     ```
   + *对于查询 API：*

     ```
     com.amazonaws.<region>.timestream.query-<cell>
     ```

    其中，*<region>*是[有效的 AWS 区域代码](https://docs.aws.amazon.com/general/latest/gr/rande.html)，*<cell>*是[DescribeEndpoints 操作](https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_DescribeEndpoints.html)在 Endpoints [对象中返回的单元终端节点](https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_DescribeEndpoints.html#API_query_DescribeEndpoints_ResponseSyntax)地址（例如`cell1`或`cell2`）之一。有关更多详细信息，请参阅[示例](#VPCEndpoints.vpc-endpoint-create.vpc-endpoint-name.example)。

1. 现在，您已构造 VPC 端点服务名称，请[创建接口端点](https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-interface.html)。当系统要求提供 VPC 端点服务名称时，请使用您在步骤 2 中构造的 VPC 端点服务名称。

### 示例：构造 VPC 端点服务名称
<a name="VPCEndpoints.vpc-endpoint-create.vpc-endpoint-name.example"></a>

在以下示例中，`DescribeEndpoints`操作是使用该`us-west-2`区域的 Write AP AWS I 在 CLI 中执行的：

```
aws timestream-write describe-endpoints --region us-west-2
```

此命令将返回以下输出：

```
{
    "Endpoints": [
        {
            "Address": "ingest-cell1.timestream.us-west-2.amazonaws.com",
            "CachePeriodInMinutes": 1440
        }
    ]
}
```

在这种情况下，*cell1*是，是*<cell>*，*us-west-2*是*<region>*。因此，生成的 VPC 端点服务名称将如下所示：

```
com.amazonaws.us-west-2.timestream.ingest-cell1
```

现在，您已经为 Timestream 创建了接口 VPC 终端节点 LiveAnalytics，[请为其创建 Timestream 的 VPC 终端节点策略](VPCEndpoints.vpc-endpoint-policy.md)。 LiveAnalytics

# 为 Timestream 创建 VPC 终端节点策略 LiveAnalytics
<a name="VPCEndpoints.vpc-endpoint-policy"></a>

您可以将终端节点策略附加到您的 VPC 终端节点，以控制对 Timestream 的 LiveAnalytics访问权限。该策略指定以下信息：
+ 可执行操作的主体。
+ 可执行的操作。
+ 可对其执行操作的资源。

有关更多信息，请参阅《Amazon VPC 用户指南》**中的[使用 VPC 端点控制对服务的访问](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints-access.html)。

**示例：用于操作的 Timestream 的 VPC 终端节点策略 LiveAnalytics**  
以下是 Timestream 的终端节点策略示例。 LiveAnalytics当连接到终端节点时，此策略允许所有委托人访问列出的 Timestream，以便对所有资源 LiveAnalytics 执行操作（在本例中为 [https://docs.aws.amazon.com/timestream/latest/developerguide/API_ListDatabases.html](https://docs.aws.amazon.com/timestream/latest/developerguide/API_ListDatabases.html)）。

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