Skip to content

Commit 86c3b26

Browse files
authored
Merge pull request moby#3692 from yrashk/patch-1
Problem: can't use anonymous S3 credentials
2 parents c58ee77 + b703509 commit 86c3b26

File tree

1 file changed

+4
-0
lines changed
  • cache/remotecache/s3

1 file changed

+4
-0
lines changed

cache/remotecache/s3/s3.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ func newS3Client(ctx context.Context, config Config) (*s3Client, error) {
360360
client := s3.NewFromConfig(cfg, func(options *s3.Options) {
361361
if config.AccessKeyID != "" && config.SecretAccessKey != "" {
362362
options.Credentials = credentials.NewStaticCredentialsProvider(config.AccessKeyID, config.SecretAccessKey, config.SessionToken)
363+
} else {
364+
// Setting `nil` for anonymous credentials as per
365+
// https://pkg.go.dev/github.com/aws/[email protected]/aws#AnonymousCredentials
366+
options.Credentials = nil
363367
}
364368
if config.EndpointURL != "" {
365369
options.UsePathStyle = config.UsePathStyle

0 commit comments

Comments
 (0)