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:
goff-proxy.yaml
# ...
retrievers:
- kind: s3
bucket: my-featureflag-bucket
item: flag/flags.goff.yaml
# ...
info
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 ). |
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:
info
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.
example.go
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. |