I am using java aws sdk version 1.11.30 in my project. I need to add support for regions that aren't available in the SDK.
Related to that I found this in my search https://aws.amazon.com/blogs/developer/using-new-regions-and-endpoints/
However, I'm not sure how to do that in Java SDK.
I currently get the s3 instance like below:
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()
Question
How can I set the base url similar to how it is mentioned in the link above?
I believe that this has changed with the very latest (2.x) AWS client, but with 1.11.84 or later, you should be able to do:
AmazonS3ClientBuilder.standard().withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("endpoint", "region"))
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/client/builder/AwsClientBuilder.html
EDIT: Removed deprecated call to setEndpointConfiguration()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With