Skip to content

Commit dc1db33

Browse files
committed
if S3_ACL is empty then will not use ACL in PutObject, fix #785
1 parent fd34cf2 commit dc1db33

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# v2.4.8
22
BUG FIXES
33
- fix Object Disks path parsing from config, remove unnecessary "/"
4+
- if `S3_ACL` is empty then will not use ACL in PutObject, fix [785](https://github.com/Altinity/clickhouse-backup/issues/785)
45

56
# v2.4.7
67
BUG FIXES

ReadMe.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,10 @@ s3:
469469
bucket: "" # S3_BUCKET
470470
endpoint: "" # S3_ENDPOINT
471471
region: us-east-1 # S3_REGION
472-
acl: private # S3_ACL
472+
# AWS changed S3 defaults in April 2023 so that all new buckets have ACL disabled: https://aws.amazon.com/blogs/aws/heads-up-amazon-s3-security-changes-are-coming-in-april-of-2023/
473+
# They also recommend that ACLs are disabled: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ensure-object-ownership.html
474+
# use `acl: ""` if you see "api error AccessControlListNotSupported: The bucket does not allow ACLs"
475+
acl: private # S3_ACL
473476
assume_role_arn: "" # S3_ASSUME_ROLE_ARN
474477
force_path_style: false # S3_FORCE_PATH_STYLE
475478
path: "" # S3_PATH, `system.macros` values can be applied as {macro_name}

pkg/storage/s3.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,15 @@ func (s *S3) GetFileReaderWithLocalPath(ctx context.Context, key, localPath stri
264264

265265
func (s *S3) PutFile(ctx context.Context, key string, r io.ReadCloser) error {
266266
params := s3.PutObjectInput{
267-
ACL: s3types.ObjectCannedACL(s.Config.ACL),
268267
Bucket: aws.String(s.Config.Bucket),
269268
Key: aws.String(path.Join(s.Config.Path, key)),
270269
Body: r,
271270
StorageClass: s3types.StorageClass(strings.ToUpper(s.Config.StorageClass)),
272271
}
272+
// ACL shall be optional, fix https://github.com/Altinity/clickhouse-backup/issues/785
273+
if s.Config.ACL != "" {
274+
params.ACL = s3types.ObjectCannedACL(s.Config.ACL)
275+
}
273276
// https://github.com/Altinity/clickhouse-backup/issues/588
274277
if len(s.Config.ObjectLabels) > 0 {
275278
tags := ""

0 commit comments

Comments
 (0)