Upload to s3 with curl using pre-signed URL (getting 403)

后端 未结 4 1789
南旧
南旧 2021-02-12 11:59

I\'m using curl to call into a Java ReST API to retrieve a URL. Java then generates a pre-signed URL for S3 upload using my S3 credentials, and returns that in the ReST reply. C

4条回答
  •  庸人自扰
    2021-02-12 12:41

    Despite the fact that GeneratePresignedUrlRequest accepts an http method argument (and has a setMethod function), it appears to be unusable for anything but GET.

    http://wiki.nercomp.org/wiki/images/0/05/AmazonWebServices.pdf states "The practice of signing a request and giving it to a third-party for execution is suitable only for simple object GET requests." Perhaps setting another method can be used for something, but apparently not this.

    So, instead, I had to follow the instructions here:

    http://aws.amazon.com/articles/1434?_encoding=UTF8&jiveRedirect=1

    This is more complex, because the client is required to post a complete form, rather than just using a URL, and also means all that post info has to be communicated to the client separately, but it does seem to work.

提交回复
热议问题