# Bring your own bucket

> Keep the objects in your AWS S3, Cloudflare R2 or MinIO bucket and use Files on top.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://files.docs.sypnia.com/s3/bring-your-own-bucket/

For agents: Files bring-your-own bucket: objects in your bucket, metadata/policies/scanning/transforms by Files; AWS S3 via IAM role trusting Sypnia with external id (no long-lived keys); R2/MinIO/B2/Wasabi/any S3-compatible via access key stored encrypted with project key; files buckets create --storage s3://… --role arn; writes only under chosen prefix; external objects visible only after files buckets import.

A bucket in Files can store its objects in a bucket you own. Files keeps the metadata and applies policies, scanning and transforms; the bytes stay with you.

| Your storage                                                          | How Files gets access                                                                                         |
| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| AWS S3                                                                | an IAM role in your account that trusts Sypnia with an **external id**; Files never holds long-lived AWS keys |
| Cloudflare R2, MinIO, Backblaze B2, Wasabi, any S3-compatible service | an access key you create there, stored encrypted with the project's key                                       |

```bash
npx @sypnia/files buckets create invoices --storage s3://laespiga-invoices --role arn:aws:iam::123456789012:role/sypnia-files
```

Files writes under the prefix you choose and does not list or touch anything else in your bucket. Objects written into your bucket by other means are not visible to Files until you run `files buckets import`, which creates their metadata rows.
