External storage#
Feature availability
- Available on Self-hosted Enterprise plans
- If you want access to this feature on Cloud Enterprise, contact n8n.
n8n can store binary data produced by workflow executions externally. This feature is useful to avoid relying on the filesystem for storing large amounts of binary data.
n8n will introduce external storage for other data types in the future.
Storing n8n's binary data in S3#
n8n supports AWS S3 as an external store for binary data produced by workflow executions. You can use other S3-compatible services like Cloudflare R2 and Backblaze B2, but n8n doesn't officially support these.
Enterprise-tier feature
You will need an Enterprise license key for external storage. If your license key expires and you remain on S3 mode, the instance will be able to read from, but not write to, the S3 bucket.
Setup#
Create and configure a bucket following the AWS documentation. You can use the following policy, replacing <bucket-name> with the name of the bucket you created:
1 2 3 4 5 6 7 8 9 10 11 | |
Set a bucket-level lifecycle configuration so that S3 automatically deletes old binary data. n8n delegates pruning of binary data to S3, so setting a lifecycle configuration is required unless you want to preserve binary data indefinitely.
Once you finish creating the bucket, you will have a host, bucket name and region, and an access key ID and secret access key. You need to set them in n8n's environment:
1 2 3 4 5 | |
No region
If your provider doesn't require a region, you can set N8N_EXTERNAL_STORAGE_S3_BUCKET_REGION to 'auto'.
Validate and update your S3 bucket region format (v2.6.4 onward)#
Starting from n8n v2.6.4, the value of the environment variable N8N_EXTERNAL_STORAGE_S3_BUCKET_REGION must meet these conditions:
- Only contain alphanumeric characters (
a-z,A-Z,0-9) and hyphens (-). - Not contain underscores (
_) or other special characters.
If these conditions are not met, n8n will fail startup with connection errors even if the storage endpoint is reachable and was previously working in older versions.
If S3 connection fails after upgrading n8n to v2.6.4, verify your region value matches these conditions and redeploy n8n.
Tell n8n to store binary data in S3:
1 2 | |
Auth autodetection
To automatically detect credentials to authenticate your S3 calls, set N8N_EXTERNAL_STORAGE_S3_AUTH_AUTO_DETECT to true. This will use the default credential provider chain.
Restart the server to load the new configuration.
Usage#
After you enable S3, n8n writes and reads any new binary data to and from the S3 bucket. n8n writes binary data to your S3 bucket in this format:
1 | |
n8n continues to read older binary data stored in the filesystem from the filesystem, if filesystem remains listed as an option in N8N_AVAILABLE_BINARY_DATA_MODES.
If you store binary data in S3 and later switch to filesystem mode, the instance continues to read any data stored in S3, as long as s3 remains listed in N8N_AVAILABLE_BINARY_DATA_MODES and your S3 credentials remain valid.
Binary data pruning
Binary data pruning operates on the active binary data mode. For example, if your instance stored data in S3, and you later switched to filesystem mode, n8n only prunes binary data in the filesystem. This may change in future.
Upgrade best practices for S3 storage#
When using S3 or S3-compatible storage:
- Upgrade all n8n components (main, worker, runner) to the same version simultaneously to avoid protocol incompatibilities.
- For on-premise or S3-compatible storage over HTTP, set
N8N_EXTERNAL_STORAGE_S3_PROTOCOL=httpand include the protocol in the host configuration. - Use only supported environment variable names: for access key, use
N8N_EXTERNAL_STORAGE_S3_ACCESS_KEY.
Newer n8n versions have stricter validation and protocol handling. Older configurations may need updates after upgrading.