AWS S3
Overviewβ
Retrieves the configuration from an AWS S3 bucket. This retriever is useful when you are using AWS and want to use S3 to store you configuration files.Configure the relay proxyβ
To configure your relay proxy to use the AWS S3 retriever, you need to add the following configuration to your relay proxy configuration file:
# ...
retrievers:
- kind: s3
bucket: my-featureflag-bucket
item: flag/flags.goff.yaml
# ...
If you are using the S3 provider, the easiest way to provide credentials is to set environment variables. It will be used by GO Feature Flag to identify to your S3 bucket.
export AWS_SECRET_ACCESS_KEY=xxxx
export AWS_ACCESS_KEY_ID=xxx
export AWS_DEFAULT_REGION=eu-west-1
Field name | Mandatory | Type | Default | Description |
---|---|---|---|---|
kind | string | none | Value should be s3 .This field is mandatory and describes which retriever you are using. | |
bucket | string | none | This is the name of your S3 bucket (ex: my-featureflag-bucket ). | |
item | string | none | Path to the file inside the bucket (ex: config/flag/my-flags.yaml ). |
Compatibility with S3-Compatible Solutionsβ
The S3 retriever is compatible with S3-compatible on-premises solutions such as MinIO
.
To use an S3-compatible storage provider, ensure that you configure the following parameters:
- Endpoint URL: Provide the endpoint URL of your S3-compatible solution.
- Access Credentials: Use your S3-compatible solution's access key and secret key.
- Bucket and Key: Specify the bucket name and the key where your configuration file is stored.
The AWS SDK requires a region to be set, even if you are using an S3-compatible solution.
export AWS_DEFAULT_REGION=xxx
If you get spammed with
SDK 2025/04/25 13:07:36 WARN Response has no supported checksum.
Not validating response payload. you might want to set export AWS_RESPONSE_CHECKSUM_VALIDATION=when_required
as well.
Configure the GO Moduleβ
To configure your GO module to use the AWS S3 retriever, you need to add the following
configuration to your ffclient.Config{}
object:
The S3 Retriever v2 will use the aws-sdk-go-v2
to access your flag in an S3 bucket.
The S3 Retriever v1 will use the deprecated aws-sdk-go
to access your flag in an S3 bucket.
AWS has announce end-of-support for AWS SDK for Go v1, and it's recommended to migrate from S3 Retriever v1 to v2.
awsConfig, _ := config.LoadDefaultConfig(context.Background())
err := ffclient.Init(ffclient.Config{
PollingInterval: 3 * time.Second,
Retriever: &s3retrieverv2.Retriever{
Bucket: "my-featureflag-bucket",
Item: "flag/flags.goff.yaml",
AwsConfig: &awsConfig,
},
})
defer ffclient.Close()
Field | Mandatory | Description |
---|---|---|
Bucket | The name of your bucket. | |
Item | The location of your file in the bucket. | |
AwsConfig | An instance of aws.Config that configure your access to AWS check this documentation for more info. |