fix: enable cross-region access for S3 client
This commit is contained in:
parent
27fc78e257
commit
ba5a67905e
|
|
@ -33,12 +33,14 @@ public class S3Service {
|
|||
if (accessKey != null && !accessKey.isEmpty() && secretKey != null && !secretKey.isEmpty()) {
|
||||
s3Client = S3Client.builder()
|
||||
.region(Region.of(region))
|
||||
.crossRegionAccessEnabled(true)
|
||||
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey)))
|
||||
.build();
|
||||
} else {
|
||||
// Fallback to default credentials provider (e.g. IAM role on EC2)
|
||||
s3Client = S3Client.builder()
|
||||
.region(Region.of(region))
|
||||
.crossRegionAccessEnabled(true)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue