Skip to content

Cross region S3 file read is not working without a write or list request #4720

@yuvanakannan

Description

@yuvanakannan

Describe the bug

We are using AWS SDK V2 and CRT to read, list and write files to S3 buckets across regions (cross region enabled)
We are able to download / read the file from the primary region without any issues.
But when we tried to download from the S3 bucket in other region, it fails with error like
"s.a.a.s.s.m.S3Exception: null (Service: S3, Status Code: 400, Request ID: *****, Extended Request ID: ****)
s.a.a.s.s.m.S3Exception$BuilderImpl.build(S3Exception.java:104)"

But if we issue a list or a write operation, it does not error out. Interestingly if we execute the read/get after a list or write, read /get operation works fine.

It fails if we are directly reading (get object) file from cross region S3 bucket with out executing a list or write operation.

Expected Behavior

Download of the file from a cross region S3 bucket should work fine.

Current Behavior

It fails if we are directly reading (get object) file from cross region S3 bucket with out executing a list or write operation.

Reproduction Steps

// Downloading file
S3TransferManager.builder().s3Client(S3AsyncClient.crtBuilder().region(Region.of("us-east-1")).crossRegionAccessEnabled(true) .build()).build().downloadFile(DownloadFileRequest.builder().getObjectRequest(b -> b.bucket(s3BucketInUsw2).key(s3Key)).destination(file).build()).completionFuture().join();

Possible Solution

As a work around, we are issuing the list operation before reading the file. Also disabling the CRT works.

Additional Information/Context

aws-crt version 0.27.7. Also tested with latest AWS SDK versions - 2.21.28 and CRT 0.28.8

AWS Java SDK version used

2.21.4

JDK version used

17

Operating System and version

linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p2This is a standard priority issuetransfer-manager

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions