# S3

**Package:** `flyte.storage`

S3 specific configuration.

Authentication resolution used by Flyte + obstore:

1. If explicit static credentials are provided via Flyte S3 inputs/environment
(`access_key_id`/`secret_access_key`), those are used.

2. If static credentials are not provided, and both `AWS_PROFILE` and
`AWS_CONFIG_FILE` are available, Flyte configures a boto3-backed obstore
credential provider so profile-based auth can be used. This requires that the `boto3` library
is installed.

3. If neither of the above applies, obstore uses the default AWS credential chain
(for remote runs this commonly resolves via workload identity / IAM attached to
the service account and then IMDS fallbacks where applicable).

## Parameters

```python
class S3(
    retries: int,
    backoff: datetime.timedelta,
    enable_debug: bool,
    attach_execution_metadata: bool,
    endpoint: typing.Optional[str],
    access_key_id: typing.Optional[str],
    secret_access_key: typing.Optional[str],
    region: typing.Optional[str],
    addressing_style: typing.Optional[str],
)
```
| Parameter | Type | Description |
|-|-|-|
| `retries` | `int` | |
| `backoff` | `datetime.timedelta` | |
| `enable_debug` | `bool` | |
| `attach_execution_metadata` | `bool` | |
| `endpoint` | `typing.Optional[str]` | |
| `access_key_id` | `typing.Optional[str]` | |
| `secret_access_key` | `typing.Optional[str]` | |
| `region` | `typing.Optional[str]` | |
| `addressing_style` | `typing.Optional[str]` | |

## Methods

| Method | Description |
|-|-|
| [`auto()`](#auto) |  |
| [`for_sandbox()`](#for_sandbox) |  |
| [`get_fsspec_kwargs()`](#get_fsspec_kwargs) | Returns the configuration as kwargs for constructing an fsspec filesystem. |

### auto()

```python
def auto(
    region: str | None,
) -> S3
```
| Parameter | Type | Description |
|-|-|-|
| `region` | `str \| None` | |

**Returns:** Config

### for_sandbox()

```python
def for_sandbox()
```
### get_fsspec_kwargs()

```python
def get_fsspec_kwargs(
    anonymous: bool,
    kwargs,
) -> typing.Dict[str, typing.Any]
```
Returns the configuration as kwargs for constructing an fsspec filesystem.

| Parameter | Type | Description |
|-|-|-|
| `anonymous` | `bool` | |
| `kwargs` | `**kwargs` | |

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flyte-sdk/packages/flyte.storage/s3.md
**HTML**: https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.storage/s3/
