可以将PUT请求发送到AWS s3前置URL吗? [英] Possible to send a PUT request to aws s3 presign url?

查看:131
本文介绍了可以将PUT请求发送到AWS s3前置URL吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用presign URL将文件放入我的私有S3存储桶中.但是我一直收到此错误消息

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>

使用此命令生成预签名URL

The presign URL was generated using this command

aws s3 presign s3://< bucket-name>/<文件名>--expires-in 300

但是当我执行curl PUT请求时,发生了错误

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

curl -T<文件名>"< Generated presign url>"

一些研究是否发现有人在谈论在请求前缀URL时在标头中添加"Content_Type",但是aws cli没有要包含的标志.

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.

是否可以通过aws cli发出放置请求?

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

推荐答案

AWS CLI尚不支持预签名的PUT URL.不过,您可以使用Python Boto3轻松生成一个.该文档为这里.如果要使用预签名的PUT,只需将 ClientMethod 参数设为 put_object .

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.

这篇关于可以将PUT请求发送到AWS s3前置URL吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆