---
title: "Store your app's files in an S3 bucket in 2026, hosted in France"
url: https://while.sh/en/guides/store-files-s3/
author: "Aloïs Oddon, co-founder of Nextmap"
updated: 2026-11-19
---

# Store your app's files in an S3 bucket, with your AI (2026)

Do your users upload photos or PDFs? Ask your AI for a bucket: connected to while over MCP, it declares it in two lines, and your app connects to it with the AWS SDK.

> **The short version.** Over MCP, your AI adds an S3 bucket to your app in two lines: encrypted, versioned, hosted in France. Your AI never sees its key. What matters, like deleting a database, waits for a person's approval.

## Prerequisites

- A Node.js, Python or Go app.
- An AI that works in a terminal: Claude Code, Codex, Cursor or Gemini CLI.

## Step 1: Give your AI this message

Open your AI in your app's folder and paste this message into it:

```text titre="The message to give your AI"
Connect to while with my account (while.sh/agents), then put my app on while.
```

Your AI adds while's MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn't open, type /mcp, choose while, then Authenticate. On that page, choose "A new app", then click Authorize.

## Step 2: Open your app

Your AI gives you your app's address, for example `https://mon-appli.while.cloud`, over HTTPS.

## What your AI does

It adds two lines to while.yaml:

```yaml titre="while.yaml"
apiVersion: while/v1
project: mon-appli
services:
  - name: web
    port: 3000
    health:
      path: /health
buckets:
  - name: uploads
```

The bucket's name reaches your app in `S3_BUCKET_UPLOADS`, the storage address in `S3_ENDPOINT` and its region in `S3_REGION`. Its key arrives where the AWS SDK looks for it on its own (source 1):

```js titre="server.js"
import { S3Client } from '@aws-sdk/client-s3';

const s3 = new S3Client({
  endpoint: process.env.S3_ENDPOINT,
  region: process.env.S3_REGION,
  forcePathStyle: true,
});
```


<figure class="illus"><img src="/illustrations/guide-fonction-garde-1200.webp" srcset="/illustrations/guide-fonction-garde-768.webp 768w, /illustrations/guide-fonction-garde-1200.webp 1200w" sizes="(min-width: 48rem) 46rem, 100vw" width="1536" height="1024" loading="lazy" decoding="async" alt="An S3 bucket for files with while: credentials kept out of the AI's reach, every call logged in the history, a person's approval for what matters and a daily backup, in France" /><figcaption>Around every app, while keeps the credentials, the history, the approvals and the backups.</figcaption></figure>

## Recover a file deleted by mistake

> You, to your AI: Bring back the invoice that was deleted yesterday.

The bucket keeps the old content of a replaced or deleted file for 30 days, and your AI puts it back.

## Keep the bucket's key secret

> You, to your AI: Give me the bucket's key.

Your AI never sees it: the key reaches only your app, in its variables.

## Add a database

> You, to your AI: Add a PostgreSQL database.

Your AI declares the database in while.yaml, and its address reaches your code in `DATABASE_URL`. It is backed up every day, and can go back to a precise moment if needed.

## Restrict your app to your colleagues

> You, to your AI: Restrict the app to people in the company.

Your AI makes the service internal:

```yaml titre="while.yaml"
    access: internal
```

Then it asks for the Access role for your domain, @acme.com, on this app, and a person in your organization approves it.

Once your Google Workspace or Microsoft 365 is connected to while, on the Pro plan, your colleagues sign in with their usual account, and your code receives their name and email address, with no sign-in page to write.

## Go back to the previous version

> You, to your AI: Go back to the previous version.

In the 30 minutes after a production release, the previous version comes back in a second. After that, it takes a few seconds. Once the previous version is back, your AI reads what broke in while's logs, fixes it and deploys again.

## Next steps

- [Deploy a Node.js API and its PostgreSQL database](/en/guides/deploy-node-api-postgresql/)
- [Add a Redis-compatible cache](/en/guides/add-redis-cache/)
- [Compare the hosts that have an MCP server](/en/comparisons/mcp-hosting-claude-code/)

## Sources

1. [AWS SDK for JavaScript v3, where the SDK looks for its credentials in Node.js (environment variables first)](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html), 2026-11-02

## Questions

### How much does storage cost?

€0.25 per 10 GiB per month, requests included.

### Are my files encrypted?

Yes, and each bucket belongs to your organization alone.

### Which SDK do I use?

The AWS S3 SDK, or any S3-compatible client.

### Where do my app and its data run?

In France, at Nextmap. The database is backed up every day, with a way back over 14 days, once a person approves.

### Does my AI see my credentials?

No. You paste them into while, the app uses them, and your AI never sees them. Every call is logged.
