4 ms·
The presigned requests are great, you can also use multi-part presigned URL to upload a large file in multiple chunks and resume the upload if it's interrupted.
by geekuillaume 8y ago
The presigned requests are great, you can also use multi-part presigned URL to upload a large file in multiple chunks and resume the upload if it's interrupted.
Just one precision, you don't need to contact S3 to get a presigned URL, it's a cryptographic operation most libs do on your server. This means that if your key is invalid for any reason, the URL will be signed but the error will only be raised when the client starts the upload. You need to check for this in your code.
- have_faith 8y ago> you don't need to contact S3 to get a presigned URL Does this mean, in the example code on AWS where they import the AWS S3 library to create a presigned url, the library just generates it in situ instead of firing off a request to S3 asking for the URL?
- philliphaydon 8y agoYou don't even need AWS SDK to do the generation, you could roll your own. (I had to do that long time ago when doing a Windows Store App for Windows 8 and they didn't support it) If you pull in their SDK it's easier. One of the benefits to the signed URL stuff is you can actually include metadata in the url which will be attached as attributes on the S3 object. For example i had a UI which would allow user to enter data for a photo they uploaded. When they hit submit it would save the data to the database and return a signed url. The signed url would contain the id to the id of the record in the database. Then when the file was uploaded to s3, i could raise an event into a Lambda, and that would give me the attributes to the record in the database. So I could process the image for a thumbnail then ping a url with an update for the file. And never need to 'figure out' which record in the database it belonged to. The user cannot change the id because the id is signed as part of the requested.