Configure file storage before uploading durable files or adding app replicas. Sim supports local disk, AWS S3, Azure Blob Storage, and Google Cloud Storage (GCS).
How the backend is selected
Set STORAGE_PROVIDER to local, s3, azure, or gcs to select a backend explicitly. When it is unset, Sim infers the backend from the configured environment variables in this order:
- Azure Blob Storage — used if
AZURE_STORAGE_CONTAINER_NAMEis set and either (AZURE_ACCOUNT_NAME+AZURE_ACCOUNT_KEY) orAZURE_CONNECTION_STRINGis set. - AWS S3 — used if
S3_BUCKET_NAMEandAWS_REGIONare set (and Azure is not configured). - Google Cloud Storage — used if
GCS_BUCKET_NAMEis set (and neither Azure nor S3 is configured). - Local disk — the fallback when no cloud backend is activated. Azure activates from its main container or credentials; S3 activates from any of its bucket names or
S3_ENDPOINT; GCS activates fromGCS_BUCKET_NAME. Dedicated Azure container names or GCS bucket names alone do not activate those providers.
If STORAGE_PROVIDER is unset, Sim uses the first backend whose configuration is complete, in that order. An explicit STORAGE_PROVIDER takes precedence and must be valid and complete.
A partially configured backend is skipped, so a fully configured one later in the order still wins. A backend whose values are present but malformed is different: it stops startup immediately, and a later fully configured one does not take over. An activated but incomplete backend does not fall back to local disk: if no other backend is complete, startup fails with File storage is partially or incorrectly configured. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are checked as a pair — set both or neither.
Set up AWS S3
Create the buckets
Sim separates files into purpose-specific buckets. Sim never creates buckets — create each one yourself before configuring it. Most S3 bucket variables do not fall back to
S3_BUCKET_NAME: leaveS3_KB_BUCKET_NAME,S3_CHAT_BUCKET_NAME,S3_COPILOT_BUCKET_NAME, orS3_PROFILE_PICTURES_BUCKET_NAMEunset and it resolves to an empty bucket name, so that file type fails to store. Three behave differently —S3_OG_IMAGES_BUCKET_NAMEandS3_WORKSPACE_LOGOS_BUCKET_NAMEfall back toS3_BUCKET_NAME, andS3_EXECUTION_FILES_BUCKET_NAMEfalls back to a literal default name (see the reference table below).Code The command omits
LocationConstraintinus-east-1, which requires that exception. See AWS CreateBucket.Keep all buckets private (block public access). Uploads use short-lived signed URLs and downloads are proxied through the app. Buckets do not need public read access.
Configure CORS on every bucket
Uploads are sent directly from the browser to S3 via presigned
PUTrequests, so each bucket needs a CORS policy that allows your Sim origin. A missing or mismatched policy can block browser uploads even when server credentials work.Code Set
AllowedOriginsto your exact Sim origin (scheme + host, no trailing slash). Add every origin users reach Sim from, including an apex/wwwpair if both are live.Grant access with an IAM policy
Create an IAM policy scoped to your buckets and attach it to the user (or role) Sim runs as:
Code You then have two ways to supply credentials:
- Static keys — create an IAM user with this policy and set
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY. - Instance/role credentials (recommended) — attach the policy to the EC2 instance role, ECS task role, or EKS IRSA role. Leave
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYunset and Sim falls back to the default AWS credential chain automatically.
- Static keys — create an IAM user with this policy and set
Configure environment variables
Set the region, optionally the credentials, and the bucket names:
Code AWS_REGIONandS3_BUCKET_NAMEare what switch Sim into S3 mode, but they do not cover the other file types — set every bucket above, because only the OpenGraph and workspace-logo buckets fall back to the general one.
S3 bucket reference
Set up Azure Blob Storage
Create one private container per purpose; Sim does not create them. Authenticate with either a connection string or an account name and key.
Create all eight containers before applying the variables. For example, with account-name/key credentials:
For connection-string credentials, replace the account options with --connection-string "$AZURE_CONNECTION_STRING".
Direct browser uploads require a Blob service CORS rule on the storage account. Allow your exact
Sim origin, GET and PUT, the Content-Type header, and the x-ms-* prefix used by signed blob
and metadata headers. Small-file uploads also send If-None-Match; the signature itself is
create-only, so a signed URL cannot overwrite an existing final object. Multipart completion verifies uploaded parts on the server:
If you authenticate with a connection string, replace the last two options with
--connection-string "$AZURE_CONNECTION_STRING". CORS is configured once for the account's Blob
service and applies to all of its containers.
A full Helm example lives at helm/sim/examples/values-azure.yaml.
Set up Google Cloud Storage
Create the buckets
GCS uses one bucket per purpose, mirroring the S3 layout:
Code Keep all buckets private (no
allUsersbindings). Uploads use short-lived V4 signed URLs and downloads are proxied through the app. Buckets do not need public read access.Because uploads are sent directly from the browser via signed
PUTrequests, each bucket needs a CORS policy that allows your Sim origin:Code Keep the explicit metadata and
x-goog-if-generation-matchheaders in this policy: Sim signs create-only uploads, which prevent a reused URL from replacing existing bytes. Multipart completion reads provider-authoritative part state on the server; the browser does not needETagfor completion. See GCS CORS configuration.Grant access
Create a service account (or reuse the one your workload runs as) and grant it object access on the buckets:
Code You then have two ways to supply credentials:
-
Application Default Credentials (recommended on GCP) — run Sim with the service account via GKE Workload Identity (or attach it to the GCE instance) and leave
GCS_CREDENTIALS_JSONunset. Because there is no private key in this mode, generating signed URLs uses the IAMsignBlobAPI — grant the service accountroles/iam.serviceAccountTokenCreatoron itself:Code -
Inline key (for Docker Compose or non-GCP hosts) — create a JSON key for the service account and set
GCS_CREDENTIALS_JSONto its contents. With a private key present, signed URLs are generated locally and no extra IAM role is needed.
-
Configure environment variables
Code GCS_BUCKET_NAMEis what switches Sim into GCS mode and is the only bucket strictly required: every purpose-specific bucket falls back to it when unset. GCS bucket names are globally unique, so Sim uses no literal defaults here — not even for execution files. Set the dedicated buckets to separate the file types; leave them unset and everything lands in the general bucket.
GCS bucket reference
A full Helm example (Workload Identity, GKE) lives at helm/sim/examples/values-gcp.yaml.
Set up S3-compatible storage
Sim works with any S3-compatible store by pointing the S3 client at a custom endpoint. Configure it exactly like AWS S3 (buckets, access key, secret), then add S3_ENDPOINT — and S3_FORCE_PATH_STYLE where the provider requires path-style addressing. The examples below cover Cloudflare R2, MinIO, and RustFS. For other providers, including Backblaze B2, verify signed uploads, multipart completion, and lifecycle behavior against that provider's current S3 support.
S3_ENDPOINT is trusted operator configuration. Sim accepts HTTP and private hosts without its outbound-request guard; do not derive it from untrusted input.
Cloudflare R2 uses virtual-hosted style (the default) and the region auto:
Leave S3_FORCE_PATH_STYLE unset — R2 supports the default virtual-hosted addressing.
For a MinIO endpoint without bucket subdomain routing, use path-style addressing and the region configured by its operator. Ceph RGW supports both addressing styles when DNS is configured:
http:// works server-side, but since the browser uploads directly to this endpoint, prefer a TLS endpoint your users can reach (a mixed-content http:// target will be blocked on an https:// Sim origin).
For RustFS, configure the endpoint, access key/secret, and region for your installation. This example uses path-style addressing:
The same browser-reachability and CORS requirements apply.
Apply the configuration
Add the storage variables to the .env file used by docker-compose.prod.yml, then restart:
New uploads now use the selected backend. Preserve any existing local files until you have migrated them; changing the storage configuration does not copy their bytes.
Set the variables under app.env (non-secret, e.g. region and bucket names) and supply credentials through a secret. The chart ships a complete example at helm/sim/examples/values-aws.yaml:
On EKS, prefer IRSA: attach the IAM policy to the service account's role and leave the access-key variables unset.
Configure incomplete multipart cleanup
Sim uploads directly to a create-only final object key and keeps upload-session state in PostgreSQL.
The /api/cron/cleanup-tasks endpoint claims expired sessions before deleting uploaded objects or aborting provider multipart state. Neither shipped scheduler calls this endpoint. Configure an authenticated operator-owned schedule as shown in Background jobs. Provider lifecycle cleanup is a second layer for multipart state that outlives its database row:
- On AWS S3 and Google Cloud Storage, abort incomplete multipart uploads after two days on every purpose-specific bucket.
- Azure automatically removes uncommitted blocks after seven days.
- For an S3-compatible provider, configure incomplete-multipart cleanup when its lifecycle implementation supports it. Check the provider's documentation because support varies.
The provider window should exceed the 24-hour upload-session lifetime so an in-progress completion can still recover. Do not add an object-expiration rule for final upload keys.
Verify storage
After restarting with the new configuration:
- Open the app and upload a document to a knowledge base (or set a profile picture).
- Confirm an object appears in the corresponding bucket/container.
- Reload the page — the file should still render (downloads stream back through the app at
/api/files/serve).
If uploads fail, check the app logs for credential or permission errors (see Troubleshooting).