我一直试图通过公共访问将对象上载到S3,但是我无法做到这一点。
我收到此错误:InvalidArgument: Argument format not recognized status code: 400
这是我的代码:
bucketName := "test-bucket"
key2 := "test.zip"
upParams := &s3manager.UploadInput{
Bucket: &bucketName,
Key: &key2,
Body: response.Body,
GrantRead: aws.String("uri:http://acs.amazonaws.com/groups/global/AllUsers"),
}
sess := session.Must(session.NewSession())
uploader := s3manager.NewUploader(sess)
_, err = uploader.Upload(upParams)
答案 0 :(得分:6)
尝试ACL:改为“公开阅读”
bucketName := "test-bucket"
key2 := "test.zip"
upParams := &s3manager.UploadInput{
Bucket: &bucketName,
Key: &key2,
Body: response.Body,
ACL: "public-read",
}
sess := session.Must(session.NewSession())
uploader := s3manager.NewUploader(sess)
_, err = uploader.Upload(upParams)