---
sidebar_position: 40
description: How to configure an AWS S3 retriever.
---
import { integrations } from "@site/data/integrations";
import {Mandatory, NotMandatory} from "@site/src/components/checks/checks";
export const retrieverName = 'AWS S3'
export const info = integrations.retrievers.find((r) => r.name === retrieverName)

# AWS S3

## Overview
{info.longDescription ?? info.description}

## Configure the relay proxy

To configure your relay proxy to use the {retrieverName} retriever, you need to add the following
configuration to your relay proxy configuration file:

```yaml title="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.

```shell
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`     | <Mandatory /> | string | **none** | **Value should be `s3`**.<br/>_This field is mandatory and describes which retriever you are using._ |
| `bucket`   | <Mandatory /> | string | **none** | This is the name of your S3 bucket _(ex: `my-featureflag-bucket`)_.                                  |
| `item`     | <Mandatory /> | 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 {retrieverName} retriever, you need to add the following
configuration to your `ffclient.Config{}` object:

:::info
The [**S3 Retriever v2**](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag@v1.23.1/retriever/s3retrieverv2) will use the [`aws-sdk-go-v2`](https://github.com/aws/aws-sdk-go-v2) to access your flag in an S3 bucket.

The [**S3 Retriever v1**](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag@v1.23.1/retriever/s3retriever) will use the deprecated [`aws-sdk-go`](https://github.com/aws/aws-sdk-go) to access your flag in an S3 bucket.

[AWS has announce end-of-support for AWS SDK for Go v1](https://aws.amazon.com/blogs/developer/announcing-end-of-support-for-aws-sdk-for-go-v1-on-july-31-2025/), and it's recommended to migrate from S3 Retriever v1 to v2.
:::

```go title="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`**    | <Mandatory /> | The name of your bucket.                                                                                                                                                                       |
| **`Item`**      | <Mandatory /> | The location of your file in the bucket.                                                                                                                                                       |
| **`AwsConfig`** | <Mandatory /> | An instance of `aws.Config` that configure your access to AWS <br/>*check [this documentation for more info](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html)*. |
