JustStarted
JustStarted

Reputation: 309

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??

Upvotes: 4

Views: 5985

Answers (1)

jellycsc
jellycsc

Reputation: 12349

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.

Upvotes: 5

Related Questions