2016-11-29 01:44
浏览 110


I followed instructions on this issue https://github.com/aws/aws-sdk-go/issues/467 which clearly documented how to create a pre-signed url for a PUT request. The goal is to presign the url, so I can directly upload images from the browser safely

key and secret are of course my current credentials that work with direct PutObject requests via the SDK

creds := credentials.NewStaticCredentials("key", "secret", "")

cfg := aws.NewConfig().WithRegion("us-west-2").WithCredentials(creds)
srv := s3.New(session.New(), cfg)

params := &s3.PutObjectInput{
    Bucket: aws.String("my-bucket"),
    Key:    aws.String("/local/test/filename"), 
req, _ := srv.PutObjectRequest(params)
url, err := req.Presign(15 * time.Hour)
if err != nil {
    fmt.Println("error signing request", err)

fmt.Println("URL", url)


I then take that URL and make a curl request. I get this response

<?xml version="1.0" encoding="UTF-8"?>
    <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>


any ideas why the presigned URL is providing me a signature that supposedly does not match? Again these same credentials are currently working for direct PutObject commands on my server

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题