通过站点到站点 VPN 从本地连接到 AWS s3

Connect to AWS s3 from on-premise via site-to-site VPN

我们有一个混合模型,内部部署通过站点到站点 VPN 连接到 AWS。出于安全考虑,需要将数据从 s3 下载到内部部署,使流量从内部部署到 AWS 并返回,而无需进入开放的 Internet。 IE。与此类似: on-prem --VPN--> AWS private subnet --> s3 endpoint --> s3

此模式适用于接口端点,因为它们生成可用于从本地调用的私有 DNS 名称,但 s3 端点是网关端点,而不是接口端点,因此它不会生成私有 DNS名字。

如何实现?

根据 VPC endpoints documentation S3 不提供通过 VPN 的直接访问:

Endpoint connections cannot be extended out of a VPC. Resources on the other side of a VPN connection, a VPC peering connection, an AWS Direct Connect connection, or a ClassicLink connection in your VPC cannot use the endpoint to communicate with resources in the endpoint service.

但是,您可以通过您的 VPN 连接将 Amazon S3 IP address ranges 路由到 VPC,并在存储桶策略中明确允许访问您的 VPN public IP 地址的 S3 存储桶,并拒绝其他所有内容。

请注意,Amazon S3 IP 地址范围可能会发生变化。

2021 年 2 月,AWS 发布了不同于 S3 网关端点的 S3 PrivateLink 接口端点。

区别在于 S3 接口端点解析为私有 VPC IP 地址,并且可以从 VPC 外部路由(例如通过 VPN、Direct Connect、Transit Gateway 等)。 S3 网关端点使用 public IP 范围并且只能从 VPC 内的资源路由。

接口端点意味着您可以通过 VPN 和一个或多个子网从本地网络路由到 S3 存储桶,而无需 VPC 中的代理,也无需遍历 public Internet。

参考blog announcement and the S3 privatelink user guide了解更多详情。