Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to send a PUT request to aws s3 presign url?

I've been trying to make use of the presign URL to put a file into my private S3 bucket. But I kept receiving this error message

<Code>SignatureDoesNotMatch</Code> <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>

The presign URL was generated using this command

aws s3 presign s3://<bucket-name>/<file-name> --expires-in 300

But when I do a curl PUT request, the error occurred

curl -T "<file-name>" "<Generated presign url>"

Did some research saw people talking about adding the 'Content_Type' in the header when requesting for the presign URL, but the aws cli doesn't have that flag to include.

Is it possible to do a put request through aws cli??

like image 907
JustStarted Avatar asked Aug 31 '25 22:08

JustStarted


1 Answers

AWS CLI doesn't support presigned PUT URL yet. You can easily generate one using Python Boto3 though. The documentation is here. If you want a presigned PUT, you just need to let ClientMethod param be put_object.

like image 66
jellycsc Avatar answered Sep 03 '25 13:09

jellycsc