# Amazon S3

Canonical URL: https://developers.iagenify.com/sdk/ref/providers/s3/
Language: en

`api.storage.connect({ type: "object", provider: "s3", endpoint })`

A bucket of your own on S3. The same five actions as R2, signed the same way — the region is the one thing that differs.

Status: type: object · SigV4 · region matters

## Connecting {#connect}

```javascript
const bucket = await api.storage.connect({
  label: "Archive",
  type: "object",
  provider: "s3",
  endpoint: {
    credentials: {
      bucketName: "my-archive",
      region: "eu-west-3",
      accessKeyId: "…",
      secretAccessKey: "…",
    },
  },
});
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `credentials.bucketName` | string | required | The bucket. |
| `credentials.region` | string | us-east-1 | Where it lives. Part of the address **and** of the signature. |
| `credentials.accessKeyId` | string | required | The access key. |
| `credentials.secretAccessKey` | string | required | Its secret. |

> **A wrong region looks like a permission problem**
>
> The region is signed into every request, so a bucket in eu-west-3 reached as us-east-1 is refused — and the refusal talks about the signature, not about the region. Set it explicitly whenever the bucket is not in the default one.

## The five actions {#actions}

| Call | Does |
| --- | --- |
| `{ action: "list", prefix, limit, recursive, continuationToken }` | Lists keys and folders under a prefix. |
| `{ action: "overview" }` | Top-level folders, with counts, bytes and a sample. |
| `{ action: "object", key }` | Reads one object — `text` or `base64`. |
| `{ action: "upload", key, contentBase64 \| content, contentType }` | Writes one object. |
| `{ action: "delete", key }` | Removes one object. |

Everything on the [R2 page](/sdk/ref/providers/r2) about folders, paging, binary content and key encoding applies identically here — the two share one implementation, and the shapes that come back are the same.

## What the key needs to be allowed {#permissions}

| Action | Needs |
| --- | --- |
| `list` · `overview` | listing the bucket |
| `object` | reading an object |
| `upload` | writing an object |
| `delete` | deleting an object |

A key allowed to read but not to list makes `object` work while `list` is refused — which reads as « the bucket is empty » if you only ever call `list`. Grant listing, or work from keys you already hold.

## Errors keep the provider's message {#errors}

A refusal comes back as `Échec du listage S3/R2 (HTTP 403)` followed by the provider's own explanation, pulled out of its XML. That message is the fastest route to the cause: a missing permission, a wrong region, an expired key.

## It is registered, not tested {#untested}

`connect()` stores the credentials and returns. Nothing is verified until the first `run()` — see [connect()](/sdk/ref/storage/connect).

- [connect()](/sdk/ref/storage/connect): The call itself, and where the secret goes.
- [Cloudflare R2](/sdk/ref/providers/r2): Same actions, no region.
- [run()](/sdk/ref/connected-storage/run): Every action, and what each one takes.

```python
bucket = api.storage.connect(
    label="Archive",
    type="object",
    provider="s3",
    endpoint={
        "credentials": {
            "bucketName": "my-archive",
            "region": "eu-west-3",
            "accessKeyId": "…",
            "secretAccessKey": "…",
        },
    },
)
```
