适用于 Amazon Location 的 AWS PrivateLink - Amazon Location Service

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

适用于 Amazon Location 的 AWS PrivateLink

借助适用于 Amazon Location 的 AWS PrivateLink,您可以在 Virtual Private Cloud(Amazon VPC)中预置接口 Amazon VPC 端点(接口端点)。这些端点可从本地(通过 VPN 及 Direct Connect)或其它 AWS 区域(通过 Amazon VPC 对等连接)中的应用程序直接访问。使用 AWS PrivateLink 和接口端点,您可以简化应用程序与 Amazon Location 之间的私有网络连接。

VPC 中的应用程序无需公有 IP 地址即可与 Amazon Location 接口 VPC 端点进行通信来执行 Amazon Location 操作。接口端点由一个或多个弹性网络接口(ENI)表示,这些接口是从 Amazon VPC 中的子网分配的私有 IP 地址。通过接口端点向 Amazon Location 发出的请求仍留在 Amazon 网络上。您还可以通过 Direct Connect 或 AWS Virtual Private Network(Site-to-Site VPN)从本地部署应用程序访问 Amazon VPC 中的接口端点。有关如何将 Amazon VPC 与本地网络连接的更多信息,请参阅 Direct Connect 用户指南AWS 站点到站点 VPN 用户指南

有关接口端点的一般信息,请参阅《AWS PrivateLink 指南》中的接口 Amazon VPC 端点(AWS PrivateLink)

适用于 Amazon Location Service 的 Amazon VPC 端点类型

您可以使用一种类型的 Amazon VPC 端点来访问 Amazon Location Service:接口端点(通过使用 AWS PrivateLink)。接口端点使用私有 IP 地址将请求从您的 Amazon VPC 内部、本地或另一个 AWS 区域中的 Amazon VPC(通过使用 Amazon VPC 对等连接)路由到 Amazon Location。有关更多信息,请参阅 What is Amazon VPC peering?Transit Gateway 与 Amazon VPC 对等连接

接口端点与网关端点兼容。如果您在 Amazon VPC 中有现有网关端点,则可以在同一 Amazon VPC 中使用这两种类型的端点。

适用于 Amazon Location 的接口端点具有以下属性:

  • 您的网络流量仍保留在 AWS 网络中

  • 使用 Amazon VPC 中的私有 IP 地址访问 Amazon Location Service

  • 允许从本地访问

  • 允许从另一个 AWS 区域中的 Amazon VPC 端点使用 Amazon VPC 对等连接或 AWS Transit Gateway 进行访问

  • 需要支付接口端点费用

Amazon VPC 注意事项对适用于 Amazon Location Service 的 AWS PrivateLink 也适用。有关更多信息,请参阅《AWS PrivateLink 指南》中的接口端点注意事项AWS PrivateLink 限额。此外,以下限制将适用:

适用于 Amazon Location Service 的 AWS PrivateLink 不支持以下各项:

  • 传输层安全性协议(TLS)1.1

  • 私有域名系统和混合域名系统(DNS)服务

Amazon VPC 端点:

  • 不支持 Amazon Location Service 地图 API 操作,包括:GetGlyphsGetSpritesGetStyleDescriptor

  • 不支持跨区域请求。确保在计划向 Amazon Location Service 发出 API 调用的同一区域中创建端点。

  • 仅通过 Amazon Route 53 支持 Amazon 提供的 DNS。如果您希望使用自己的 DNS,请使用条件 DNS 转发。有关更多信息,请参阅《Amazon VPC 用户指南》中的 DHCP 选项集

  • 必须通过附加到 VPC 端点的安全组,允许端口 443 上来自 VPC 私有子网的传入连接。

对于您启用的每个 AWS PrivateLink 端点,您每秒最多可以提交 5 万个请求。

注意

AWS PrivateLink 端点的网络连接超时不在 Amazon Location 错误响应的范围内,需要由连接到 AWS PrivateLink 端点的应用程序适当进行处理。

为 Amazon Location Service 创建接口端点

您可以使用 Amazon VPC 控制台或 AWS Command Line Interface(AWS CLI)为 Amazon Location Service 创建接口端点。有关更多信息,请参阅《AWS PrivateLink 指南》中的创建接口端点

共有六个不同的 VPC 端点,Amazon Location Service 提供的每项功能各一个。

类别 端点
地图

com.amazonaws.region.geo.maps

地点

com.amazonaws.region.geo.places

路线

com.amazonaws.region.geo.routes

地理围栏

com.amazonaws.region.geo.geofencing

跟踪器

com.amazonaws.region.geo.tracking

元数据

com.amazonaws.region.geo.metadata

例如 。

com.amazonaws.us-east-2.geo.maps

在创建端点后,您可以选择启用私有 DNS 主机名。创建 VPC 端点时,在 Amazon VPC 控制台中选择启用私有 DNS 名称即可启用。

如果为接口端点启用私有 DNS,则可使用其默认区域 DNS 名称向 Amazon Location Service 服务发出 API 请求。以下示例显示了默认区域 DNS 名称格式。

  • maps.geo.region.amazonaws.com

  • places.geo.region.amazonaws.com

  • routes.geo.region.amazonaws.com

  • tracking.geo.region.amazonaws.com

  • geofencing.geo.region.amazonaws.com

  • metadata.geo.region.amazonaws.com

之前的 DNS 名称适用于 IPv4 域。以下 IPV6 DNS 名称也可用于接口端点。

  • maps.geo.region.api.aws

  • places.geo.region.api.aws

  • routes.geo.region.api.aws

  • tracking.geo.region.api.aws

  • geofencing.geo.region.api.aws

  • metadata.geo.region.api.aws

从 Amazon Location 接口端点访问 Amazon Location API 操作

您可以使用 AWS CLIAWS SDK 通过 Amazon Location 接口端点访问 Amazon Location API 操作。

示例:创建 VPC 端点

aws ec2 create-vpc-endpoint \ --region us-east-1 \ --service-name location-service-name \ --vpc-id client-vpc-id \ --subnet-ids client-subnet-id \ --vpc-endpoint-type Interface \ --security-group-ids client-sg-id

示例:修改 VPC 端点

aws ec2 modify-vpc-endpoint \ --region us-east-1 \ --vpc-endpoint-id client-vpc-endpoint-id \ --policy-document policy-document \ #example optional parameter --add-security-group-ids security-group-ids \ #example optional parameter # any additional parameters needed, see PrivateLink documentation for more details

更新本地 DNS 配置

使用特定于端点的 DNS 名称访问适用于 Amazon Location 的接口端点时,您无需更新本地 DNS 解析程序。您可以使用来自公有 Amazon Location DNS 域的接口端点的私有 IP 地址解析特定于端点的 DNS 名称。

使用接口端点访问 Amazon Location,无需 Amazon VPC 中的网关端点和互联网网关

Amazon VPC 中的接口端点可以通过 Amazon 网络,将 Amazon VPC 内的应用程序和本地应用程序路由到 Amazon Location。

为 Amazon Location 创建 Amazon VPC 端点策略

您可以为 Amazon VPC 端点附加一个端点策略,以控制对 Amazon Location 的访问。该策略指定以下信息:

  • 可执行操作的 AWS Identity and Access Management (IAM) 主体

  • 可执行的操作

  • 可对其执行操作的资源

示例:用于访问 Amazon Location Service 地点 API 的示例 VPCe 策略:

{ "Version": "2012-10-17", "Statement": [ { "Sid": "Allow-access-to-location-service-places-opeartions", "Effect": "Allow", "Action": [ "geo-places:*", "geo:*" ], "Resource": [ "arn:aws:geo-places:us-east-1::provider/default", "arn:aws:geo:us-east-1:*:place-index/*" ] } ] }