Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to generate a single presigned URL which can allow MULTIPLE unique objects to be uploaded?

I know based on the AWS docs here

https://docs.aws.amazon.com/AmazonS3/latest/dev/PresignedUrlUploadObject.html

that its possible to generate a URL which can can used to

upload a specific object to your bucket

and that

You can use the presigned URL multiple times, up to the expiration date and time.

It is also possible to generate a URL (perhaps a base s3 presigned URL) which would allow multiple different unique documents to be uploaded based on a single URL?

For example, lets imagine a client application would like to upload multiple unique/distinct documents to s3 using some type of presigned URL. I dont necessarily want to force them to get a batch of presigned URLs since that would require much more on the part of the client (they would have to request batch of presigned URLs, rather than a single URL)

Here is the flow for a single document upload.

enter image description here

enter image description here

What is the simplest known solution for allowing a client to use some type of presigned url to upload multiple documents?

like image 838
jbooker Avatar asked Oct 27 '25 02:10

jbooker


1 Answers

It is also possible to generate a URL (perhaps a base s3 presigned URL) which would allow multiple different unique documents to be uploaded based on a single URL?

A presigned URL is limited to a single single object key. You can't, for example, presign a key of foo and then use it to upload foo/bar (because that's a different key).

That means that, if you want to provide the client with a single pre-signed URL, the client code will have to combine the files itself. For example, you require the client to upload a ZIP file, then trigger a Lambda that unpacks the files in that ZIP.

Another approach is to use the AWS SDK from the client, and use the Assume Role operation to generate temporary access credentials that are restricted to uploading files with a specified prefix using an inline session policy.

A third approach is to hide the URL requests. You don't say what your client application does, but assuming that you let the user select some number of files, you could simply loop over those files and retrieve a URL for each one without ever letting your user know that's happening.

like image 139
Parsifal Avatar answered Oct 29 '25 16:10

Parsifal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!