diff --git a/storage/s3.go b/storage/s3.go index 934b9c1..1dc5dcf 100644 --- a/storage/s3.go +++ b/storage/s3.go @@ -66,8 +66,10 @@ func NewS3Client(cfg Cfg) (*S3Client, error) { awsCfg.EndpointResolverWithOptions = resolver } - if !cfg.UseIAM { + if !cfg.UseIAM && len(cfg.AK) != 0 && len(cfg.SK) != 0 { awsCfg.Credentials = credentials.NewStaticCredentialsProvider(cfg.AK, cfg.SK, "") + } else { + awsCfg.Credentials = aws.AnonymousCredentials{} } return &S3Client{cli: s3.NewFromConfig(awsCfg)}, nil }