diff --git a/aws/dynamodb_storage_client.go b/aws/dynamodb_storage_client.go index 872568c6bf3cc..4810bf3cf60d2 100644 --- a/aws/dynamodb_storage_client.go +++ b/aws/dynamodb_storage_client.go @@ -126,7 +126,8 @@ func (cfg *DynamoDBConfig) RegisterFlags(f *flag.FlagSet) { // StorageConfig specifies config for storing data on AWS. type StorageConfig struct { DynamoDBConfig - S3 flagext.URLValue + S3 flagext.URLValue + S3ForcePathStyle bool } // RegisterFlags adds the flags required to config this to the given FlagSet @@ -135,6 +136,7 @@ func (cfg *StorageConfig) RegisterFlags(f *flag.FlagSet) { f.Var(&cfg.S3, "s3.url", "S3 endpoint URL with escaped Key and Secret encoded. "+ "If only region is specified as a host, proper endpoint will be deduced. Use inmemory:/// to use a mock in-memory implementation.") + f.BoolVar(&cfg.S3ForcePathStyle, "s3.force-path-style", false, "Set this to `true` to force the request to use path-style addressing.") } type dynamoDBStorageClient struct { diff --git a/aws/s3_storage_client.go b/aws/s3_storage_client.go index 81a18254e8c8a..dfb74a42584f5 100644 --- a/aws/s3_storage_client.go +++ b/aws/s3_storage_client.go @@ -47,6 +47,8 @@ func NewS3ObjectClient(cfg StorageConfig, schemaCfg chunk.SchemaConfig) (chunk.O return nil, err } + s3Config = s3Config.WithS3ForcePathStyle(cfg.S3ForcePathStyle) // support for Path Style S3 url if has the flag + s3Config = s3Config.WithMaxRetries(0) // We do our own retries, so we can monitor them s3Client := s3.New(session.New(s3Config)) bucketName := strings.TrimPrefix(cfg.S3.URL.Path, "/")