Skip to content

Commit 1f299ae

Browse files
committed
add bucket-owner-full-control object acl for s3 output
cr https://cr.amazon.com/r/6566909/
1 parent cfc6b6a commit 1f299ae

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

agent/s3util/s3util.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,16 @@ func (m *Manager) S3UploadFromReader(bucketName string, objectKey string, conten
7171
Body: content,
7272
ContentType: aws.String("text/plain"),
7373
}
74-
_, err = m.S3.PutObject(params)
74+
if _, err = m.S3.PutObject(params); err == nil {
75+
aclParams := &s3.PutObjectAclInput{
76+
Bucket: aws.String(bucketName),
77+
Key: aws.String(objectKey),
78+
ACL: aws.String("bucket-owner-full-control"),
79+
}
80+
// gracefully ignore the error, since the S3 putAcl policy may not be set
81+
m.S3.PutObjectAcl(aclParams)
82+
}
83+
7584
return
7685
}
7786

0 commit comments

Comments
 (0)