Amazon S3 presigned-urls allow arbitrary users to upload files to an S3 bucket. The following sections show how you can upload files if you are provided an Amazon S3 presigned-url.
Windows PowerShell
The Invoke-WebRequest commandlet can be used to make a PUT request and upload a file.
Invoke-WebRequest -Method "PUT" -InFile "FILE_YOU_WANT_TO_UPLOAD" "WHOLE_PRESIGNED_URL_LINK_HERE"
Replace the ‘FILE_YOU_WANT_TO_UPLOAD’ text with the relative path to the file. Replace ‘WHOLE_PRESIGNED_URL_LINK_HERE’ with the link you have been provided with.
Curl
Curl can be used to make a PUT request, this is the method Amazon recommends in their article on generating and uploading files with presigned-urls.
curl -X "PUT" -T "FILE_YOU_WANT_TO_UPLOAD" -H "Content-Type: application/octet-stream" "WHOLE_RESIGNED_URL_LINK_HERE"
If you attempt to use the above command in a regular Windows PowerShell session, you may run into errors. This is because ‘curl’ is a mapped alias of ‘Invoke-WebRequest’.

Leave a Reply