For the complete documentation index, see llms.txt. This page is also available as Markdown.

Use 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 and execution data produced by workflow executions externally. This feature is useful to avoid relying on the database or filesystem for storing large amounts of data.

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. n8n won't start in s3 binary data mode without a valid license: set N8N_DEFAULT_BINARY_DATA_MODE to another mode or upgrade your license.

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:

{
 "Version": "2012-10-17",
 "Statement": [
  {
   "Sid": "VisualEditor0",
   "Effect": "Allow",
   "Action": ["s3:*"],
   "Resource": ["arn:aws:s3:::<bucket-name>", "arn:aws:s3:::<bucket-name>/*"]
  }
 ]
}

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:

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:

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:

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:

  1. Upgrade all n8n components (main, worker, runner) to the same version simultaneously to avoid protocol incompatibilities.

  2. For on-premise or S3-compatible storage over HTTP, set N8N_EXTERNAL_STORAGE_S3_PROTOCOL=http and include the protocol in the host configuration.

  3. 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.

Storing n8n's binary data in Azure Blob Storage

n8n supports Azure Blob Storage as an external store for binary data produced by workflow executions. This uses the same Azure Blob configuration as external execution data storage, so a single container can hold both binary data and execution data.

Enterprise-tier feature

You will need an Enterprise license key for external storage. n8n won't start in azure binary data mode without a valid license: set N8N_DEFAULT_BINARY_DATA_MODE to another mode or upgrade your license.

Azure setup

Create a blob container in your Azure storage account following the Azure documentation.

Set the container name in n8n's environment. N8N_EXTERNAL_STORAGE_AZURE_CONTAINER_NAME is always required:

For authentication, n8n supports a connection string, an account name and key, or managed identity (DefaultAzureCredential). Refer to External data storage environment variables | Azure Blob Storage for the full list of authentication variables and the order in which n8n checks them.

n8n delegates pruning of binary data to Azure, so set a lifecycle management policy on the container to automatically delete old binary data. Setting a lifecycle policy is required unless you want to preserve binary data indefinitely.

Tell n8n to store binary data in Azure Blob Storage:

Restart the server to load the new configuration.

Azure usage

After you enable Azure Blob Storage, n8n writes and reads any new binary data to and from the container. n8n writes binary data to your container in this format:

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 Azure Blob Storage and later switch to filesystem mode, the instance continues to read any data stored in Azure, as long as azure remains listed in N8N_AVAILABLE_BINARY_DATA_MODES and your Azure credentials remain valid.

Storing n8n's execution data in S3

n8n can also store execution data in S3.

Configure the S3 bucket and credentials as described in the binary data setup section, then tell n8n to store execution data in S3:

In queue mode, set N8N_EXECUTION_DATA_STORAGE_MODE and the N8N_EXTERNAL_STORAGE_S3_* variables on all instances, including workers.

After you enable S3 execution data storage, n8n writes the data of any new execution to your S3 bucket in this format:

n8n records where each execution's data is stored, so switching modes is non-destructive. Older executions stay readable from the database or filesystem, and if you later switch back to another mode, executions stored in S3 stay readable as long as the bucket remains configured.

n8n prunes execution data in S3 itself, using the standard executions pruning settings (the EXECUTIONS_DATA_* variables). Unlike binary data, execution data doesn't rely on an S3 lifecycle rule. Don't add a lifecycle rule for execution data, as it could delete data that n8n still references.

Last updated

Was this helpful?