Ant*_*ony 1 java amazon-web-services aws-sdk
我1.11.30在我的项目中使用 java aws sdk 版本。我需要添加对 SDK 中不可用区域的支持。
与此相关,我在搜索中找到了这个https://aws.amazon.com/blogs/developer/using-new-regions-and-endpoints/
但是,我不确定如何在 Java SDK 中做到这一点。
我目前得到如下 s3 实例:
AmazonS3 s3 = AmazonS3ClientBuilder.standard()
.withRegion(regionName) //regionName is a string for a region not supported by the SDK yet
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(aKeyUpload, sKeyUpload)))
.build()
Run Code Online (Sandbox Code Playgroud)
题
如何设置类似于上面链接中提到的基本网址?
我相信最新的 (2.x) AWS 客户端已经改变了这一点,但是在 1.11.84 或更高版本中,您应该能够:
AmazonS3ClientBuilder.standard().withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("endpoint", "region"))
Run Code Online (Sandbox Code Playgroud)
编辑:删除了不推荐使用的调用 setEndpointConfiguration()