Issue
In AWS SDK V1, I set up my credentials as:
BasicAWSCredentials awsCredentials = new BasicAWSCredentials(Credentials.access_key, Credentials.secret_access_key);
And then set the endpoint as:
EndpointConfiguration endpoint = new EndpointConfiguration("<endpoint URL>", "<region>");
And then created the client as:
AmazonS3 s3client = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
.withEndpointConfiguration(endpoint)
.build();
How do I set up this same client using AWS SDK V2?
Solution
Looking at the Javadocs here:
See:
endpointOverride
endpointOverride(URI endpointOverride)
Configure the endpoint with which the SDK should communicate.**
Looks like you can create a URI object and pass that when you create the Service client
URI myURI = new URI("<endpoint URL>");
Region region = Region.US_EAST_1;
S3Client s3 = S3Client.builder()
.region(region)
.endpointOverride(myURI)
.build();
Answered By - smac2020
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.