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'
.
Tell n8n to store binary data in S3:
1 2 |
|
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.