How to specify chunk size in S3 multipart presigning?

I’m working on implementing the uppy-s3_multipart gem, but am having a hard time discerning how to limit the size of parts. For instance, let’s say I want to limit the total upload size of all parts to 100GB. I can do that using the content_length_range option on the mounted plugin’s options. However, if I not only wanted to limit total size 100GB, but also wanted to limit each individual part’s size to 20MB, how would I do that?

It might be that I’m just confusing the pre-signing behavior altogether, but I’m trying to understand if the back-end controls the size of the parts, or the client, or either, or both? And if back-end can/does have control over that, how to leverage that using Shrine’s uppy-s3_multipart gem?

I don’t think you can do any filesize limiting with multipart S3 uploads. According to the docs, the :content_length_range option only exists for POST presigns for simple uploads, I don’t see it for PUT presigns neither for simple uploads nor for multipart uploads. I also didn’t find any option for limiting the total filesize.

If you need to limit total filesize, the tus strategy for resumable uploads supports it. As for limiting individual chunks, neither tus nor multipart S3 uploads support that from what I’ve seen.

However, I I feel like this is not really an attack vector anyway, because the attacker would need bandwidth resources to upload such large files.

Isn’t the POST presign what’s happening for the initial “create multipart upload” piece? I know the parts themselves are the PUT presigns.

It doesn’t, it issues a “create multipart upload” request, you can easily see it from the source code. There is no “presign” for creating multipart requests.

Got it. Apologies for the runaround. Thanks!