Skip to content

Support custom endpoint for S3 #1476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,9 @@ Valid fields are (with their corresponding flags for default values):
- `max_samples_per_query` / `-ingester.max-samples-per-query`

Limits on the number of timeseries and samples returns by a single ingester during a query.

## Storage

- `s3.force-path-style`

Set this to `true` to force the request to use path-style addressing (`http://s3.amazonaws.com/BUCKET/KEY`). By default, the S3 client will use virtual hosted bucket addressing when possible (`http://BUCKET.s3.amazonaws.com/KEY`).
4 changes: 3 additions & 1 deletion pkg/chunk/aws/dynamodb_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:///<bucket-name> 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 {
Expand Down
2 changes: 2 additions & 0 deletions pkg/chunk/aws/s3_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "/")
Expand Down