aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

Set object metadata in completeMultipartUpload

Open joy45689 opened this issue 4 years ago • 1 comments

Describe the feature

Allows us to set the object metadata in completeMultipartUpload, not just in initiateMultipartUpload.

Is your Feature Request related to a problem?

I have some user-defined metadata that is calculated after I finish multipart upload. Therefore, I need to set them in completeMultipartUpload.

I know I can do this through Copying an object using multipart upload, but it will be grateful if I could simply set user-defined metadata in completeMultipartUpload.

Proposed Solution

No response

Describe alternatives you've considered

An API for updating object metadata (instead of using copy to update object metadata)

Acknowledge

  • [ ] I may be able to implement this feature request

AWS Java SDK version used

2.17.46

JDK version used

1.8.0_301

Operating System and version

Windows 10

joy45689 avatar Dec 17 '21 03:12 joy45689

Hi @joy45689. Thank you for your feedback.

This is a feature/requirement of the S3 API as documented here:

If you want to provide any metadata describing the object being uploaded, you must provide it in the request to initiate multipart upload.

And here:

After you upload the object, you cannot modify object metadata. The only way to modify object metadata is to make a copy of the object and set the metadata.

Unfortunately, there is nothing that the Java SDK can do to bypass this API design. Possible workarounds to consider:

  1. As you already mentioned, copying the object in-place while updating the object metadata. (This may be slow for very large objects.)
  2. If possible, delay or buffer your createMultipartUpload call until you can determine the metadata that you wish to use.

I will also forward your feedback to the S3 service team.

Bennett-Lynch avatar Jan 03 '22 19:01 Bennett-Lynch