I am creating an S3 Bucket for AWS Billing reports. I want to set GrantRead, GrantWrite and GrandReadACP permissions on S3 Bucket while creating it through GoLang API. Which value do I need to pass to these tags to set these three permissions for authenticated AWS users?
you can review the doc for the CreateBucket
method which takes policy arguments you mention
// set your s3 client before and define your bucket as bucketName
params := &s3.CreateBucketInput{
Bucket: aws.String(bucketName),
GrantRead: aws.String("GrantRead"),
GrantReadACP: aws.String("GrantReadACP"),
GrantWrite: aws.String("GrantWrite"),
// GrantFullControl and others available
}
result, err := s3client.CreateBucket(params)
as the issue points out it might not work so using the ACL directly as something like
// set your s3 client before and define your bucket as bucketName
params := &s3.CreateBucketInput{
Bucket: aws.String(bucketName),
ACL: aws.String("public-read | public-read-write")
}
result, err := s3client.CreateBucket(params)
see canned ACL doc for possible values