fix: enable cross-region access for S3 client

This commit is contained in:
vithobaa 2026-06-29 19:50:24 +05:30
parent 27fc78e257
commit ba5a67905e
1 changed files with 2 additions and 0 deletions

View File

@ -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();
}
}