Reputation: 221
I've been trying to upload an object to S3 with public access but I haven't been able to do it.
I am getting this error: InvalidArgument: Argument format not recognized status code: 400
Here is my code:
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)
Upvotes: 5
Views: 3510
Reputation: 34337
Try ACL : "public-read" instead
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)
Upvotes: 15