سؤال

I am trying to use pre-singed urls to upload files to S3 and until a few minutes ago I believed it is possible (there is documentation on this issue), but I just encountered this phrase in the S3 developers guide:

Query string authentication is not supported for POST 

What am I missing, By the way I am trying to use goamz (unofficial golang SDK for AWS) to do so and I keep getting signature errors.

EDIT: so far I figured out the signature, so I can sign the URL for GET, POST, PUT (I have not tried DELETE or PATCH they may work as well, if they are supported on the amazon part), right now my problem is I get zero size objects after I PUT), I'll post the code here when I make it work.

EDIT2: As mentioned below by @Basssethog it looks like, this problem is now solved in the official go-SDK

هل كانت مفيدة؟

المحلول 3

For the record it is possible,
I actually did it in go and contributed to code to goamz, find it here:
https://github.com/crowdmob/goamz

نصائح أخرى

I know that it's supported for PUT, GET and DELETE requests, but the signing becomes a bit trickier. I know that there's support in the official PHP and Ruby SDKs; possibly other official SDKs.

You might be able to port the implementation to Go.

It seems this problem has been fixed in the aws-sdk-go SDK by now:

svc := s3.New(nil)
req, _ := svc.PutObjectRequest(&s3.PutObjectInput{
    Bucket: aws.String("myBucket"),
    Key:    aws.String("myKey"),
    Body:   strings.NewReader("EXPECTED CONTENTS"),
})
str, err := req.Presign(15 * time.Minute)

log.Println("The URL is:", str, " err:", err)

Soure: http://zqsmm.qiniucdn.com/data/20150717110412/index.html

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top