Skip to content

Add presigned URL download support to S3 Transfer Manager#6951

Open
jencymaryjoseph wants to merge 2 commits into
feature/master/pre-signed-url-getobjectfrom
jencyjos/pre-signed-url-getobject/transfermanager
Open

Add presigned URL download support to S3 Transfer Manager#6951
jencymaryjoseph wants to merge 2 commits into
feature/master/pre-signed-url-getobjectfrom
jencyjos/pre-signed-url-getobject/transfermanager

Conversation

@jencymaryjoseph
Copy link
Copy Markdown
Contributor

@jencymaryjoseph jencymaryjoseph commented May 11, 2026

Motivation and Context

Adds presigned URL download support to S3 Transfer Manager with downloadFileWithPresignedUrl and downloadWithPresignedUrl methods. This enables customers to download objects using pre-signed URLs through the Transfer Manager with multipart download support and progress tracking.

Modifications

  • S3TransferManager: Added downloadFileWithPresignedUrl (with consumer builder variant) and downloadWithPresignedUrl public API methods with javadoc and code snippets.
  • GenericS3TransferManager: Implemented presigned URL download logic with multipart support and progress tracking using wrapForNonSerialFileDownload.
  • S3IntegrationTestBase: Added tmNonMultipartJava (non-multipart transfer manager) and presignedUrlTransferManagers() method source for presigned URL integration tests. CRT client is commented out with a TODO to enable when CRT presigned URL support is available.

Testing

  • S3TransferManagerPresignedUrlDownloadTest: Unit tests covering happy path (toFile/toBytes), consumer builder, cancellation forwarding, error propagation, and null validation.
  • S3TransferManagerPresignedUrlDownloadIntegrationTest: Integration tests parameterized by transfer manager type (nonMultipart/multipart) and file size (5MB/16MB), verifying data integrity with checksums for both downloadFileWithPresignedUrl and downloadWithPresignedUrl.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@jencymaryjoseph jencymaryjoseph requested a review from a team as a code owner May 11, 2026 17:24
@jencymaryjoseph jencymaryjoseph force-pushed the feature/master/pre-signed-url-getobject branch from e037d5d to 10e45b1 Compare May 11, 2026 22:19
@jencymaryjoseph jencymaryjoseph force-pushed the jencyjos/pre-signed-url-getobject/transfermanager branch from 1e11a98 to 15a7271 Compare May 12, 2026 04:52
@jencymaryjoseph jencymaryjoseph force-pushed the jencyjos/pre-signed-url-getobject/transfermanager branch from 15a7271 to f23f949 Compare May 12, 2026 16:38
private static final String SMALL_KEY = "small-key";
private static final String LARGE_KEY = "large-key";
private static final int SMALL_OBJ_SIZE = 5 * 1024 * 1024;
private static final int LARGE_OBJ_SIZE = 16 * 1024 * 1024;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please run one off tests (you dont have to commit those to the PR) against larger files like 1GB and 10GB. Trying to see if size would reveal any edge cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested for 1GB download, looks good. Will do more tests during performance tests.

@RanVaknin
Copy link
Copy Markdown
Contributor

We need to add the new methods to DelegatingS3TransferManager.java so when someone subclasses that they would get forwarded to the delegate and not hit the default unsupportedOperationException

@jencymaryjoseph jencymaryjoseph requested a review from RanVaknin May 12, 2026 22:55
public void methodTeardown() {
tm.close();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are missing tests that verify that the progress tracking works for presigned URL downloads.
See S3TransferManagerListenerTest.java as an example. (you need to make sure the callback hooks are firing for the provided transfer listener)

returnFuture.completeExceptionally(throwable);
}

return new DefaultFileDownload(returnFuture, progressUpdater.progress(), () -> null, null);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The callback shouldn't just return null. We should throw an exception instead if customers call .pause();

  () -> { throw new UnsupportedOperationException("pause is not supported...."); }

protected static S3Client s3;

protected static S3AsyncClient s3Async;
protected static S3AsyncClient s3Async;;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix typo

Arguments.of(tmJava));
}

static Stream<Arguments> presignedUrlTransferManagers() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants