在 JAVA 中使用 S3 的 VPC 端点获取 S3 对象的方法是什么?我应该使用一个简单的 http 客户端吗?或者有没有办法使用 AmazonS3ClientBuilder 来做到这一点?
最佳答案
在配置后使用 S3 VPC 端点时,您不会做任何不同的事情。您的代码没有任何变化。
当 VPC 中的子网与为 VPC 端点配置的路由表相关联时,只会发生一件事:
- 您所在区域的所有 S3 公共(public) IP 地址都路由到 VPC 端点,而不是遵循默认路由。
就是这样。
您的路由表中的前缀列表 pl-xxxxxxxx
表示您所在地区与 S3 关联的所有公共(public)子网的列表。该列表由 AWS 基础设施自动维护。当实例将流量发送到 S3 时,它会执行 DNS 查找以查找存储桶的 IP 地址。当它连接到该 IP 地址时,如果实例子网的路由表包含使用 S3 的 VPC 终端节点的前缀列表条目,它会通过该终端节点连接到 S3。
All instances in subnets associated with the specified route tables automatically use the endpoint to access the service; subnets that are not associated with the specified route tables do not use the endpoint to access the service.
http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-endpoints.html#vpc-endpoints-routing
关于amazon-web-services - 如何在 Java 中使用 S3 VPC 端点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42826341/