current docs are giving a deprecated example for config a client with go Here is a update example with the new aws sdk go v2 package config import ( "context" "os" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/credentials" "github.com/aws/aws-sdk-go-v2/service/s3" ) func InitSpaces() (*s3.Client, error) { spacesKey := os.Getenv("SPACES_KEY") spacesSecret := os.Getenv("SPACES_SECRET") creds := credentials.NewStaticCredentialsProvider(spacesKey, spacesSecret, "") cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithCredentialsProvider(creds), config.WithRegion("us-east-1"), config.WithBaseEndpoint("https://[Bucket Name].nyc3.digitaloceanspaces.com"), ) if err != nil { return nil, err } client := s3.NewFromConfig(cfg, func(o *s3.Options) { o.UsePathStyle = false // Another way to set the endpoint is with o.BaseEndpoint // o.BaseEndpoint = aws.String("[Your Digital Ocean origin endpoint]") }) return client, nil }