-
Couldn't load subscription status.
- Fork 947
-
I am using java aws sdk2 and currently creating the s3 client using following manner.
S3Client.builder()
.region(Region.of(s3Region))
.credentialsProvider(credentialsProvider)
.overrideConfiguration(overrideConfig.build())
.endpointOverride(new URI("http://localhost:9000/"))
.serviceConfiguration(S3Configuration.builder()
.pathStyleAccessEnabled(true)
.build()).build();
S3Presigner is not taking s3Client property while generating presignURL
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments 2 replies
-
Can you share a code sample showing how you are creating the S3Presigner?
Beta Was this translation helpful? Give feedback.
All reactions
-
S3Presigner presigner = S3Presigner.builder().s3Client(this.s3Client.getS3Client()).build();
URL var18;
try {
GetObjectRequest objectRequest = (GetObjectRequest)GetObjectRequest.builder().bucket(bucketName).key(objectKey).responseContentDisposition(contentDisposition).responseContentType(contentType).build();
GetObjectPresignRequest presignRequest = GetObjectPresignRequest.builder().signatureDuration(Duration.ofSeconds(seconds)).getObjectRequest(objectRequest).build();
PresignedGetObjectRequest presignedRequest = presigner.presignGetObject(presignRequest);
var18 = presignedRequest.url();
} catch (Throwable var20) {
if (presigner != null) {
try {
presigner.close();
} catch (Throwable var19) {
var20.addSuppressed(var19);
}
}
throw var20;
}
if (presigner != null) {
presigner.close();
}
return var18;
Beta Was this translation helpful? Give feedback.
All reactions
-
You need set endpointOverride and serviceConfiguration in the S3Presigner builder:
S3Presigner presigner = S3Presigner.builder() .endpointOverride(new URI("http://localhost:9000/")) .serviceConfiguration(S3Configuration.builder() .pathStyleAccessEnabled(true) .build()) .build();
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanx it worked now!
I think its not working while creating S3Presigner with s3Client
Beta Was this translation helpful? Give feedback.
All reactions
-
Hello! Reopening this discussion to make it searchable.
Beta Was this translation helpful? Give feedback.