How to migrate an n8n configuration between two VPS
Objective
This guide explains how to transfer an existing n8n configuration to an OVHcloud VPS, or from an OVHcloud VPS to another instance. You can choose either the export/import method via the CLI commands of n8n, or the backup/restore of the .n8n folder.
Requirements
- Two functional VPS (OVHcloud or others)
- Administrative (sudo) access to your server via SSH
Instructions
If you are starting from scratch, opt for an OVHcloud preinstalled n8n VPS to get started quickly.
Summary
- Method 1: Export and import via n8n CLI
- Method 2: Backup and restore the
.n8nfolder - Points to note
- Conclusion
Method 1 - Export and import via n8n CLI
n8n provides commands for exporting and importing your workflows and credentials.
Depending on your installation, you have two options:
- n8n installed in CLI mode (npm or binary): directly type
n8n export:...from your VPS. - n8n installed via Docker (OVHcloud case with image
n8nio/n8n): run the commands inside the container withdocker exec.
Step 1 - Log in to the source VPS
Open a terminal and connect via SSH to your VPS on which n8n is installed:
Step 2 - Export workflows
The paths indicated (/home/node/...) correspond to the default Docker installation of n8n. If you have customized the volumes or paths in your Docker Compose configuration, adjust them accordingly.
Run the following command to export all workflows to a file:
Identify the name of your n8n container (default is n8n):
Run the following command to generate the file inside the container:
Sample output:

Output the file from the container to place it in the file system of the source VPS:
Sample output:

Step 3 - Export credentials
Run the following command to export all decrypted credentials to a JSON file:
Run this command in the n8n container to generate the decrypted credentials file:
Sample output:

Use the --decrypted option if you are migrating to another instance to avoid encryption errors. Handle this file carefully as it contains sensitive data.
Copy this file to the file system of the source VPS:
Sample output:

Step 4 - Transfer the exported files
Copy the generated files (workflows.json and credentials.json) to your target VPS:
In the example, we transfer the files to the /root/ directory of the target VPS. You can choose another directory if required, depending on your access rights.
Step 5 - Import workflows
Connect via SSH to your target VPS:
Step 6 - Import credentials
When importing, if a workflow or credential ID already exists in the target instance, it will be overwritten. To avoid conflicts, change or delete the ID in the JSON files before importing.
Delete the credentials.json file from your source and target VPS after import to avoid any leakage of sensitive data.
Method 2 - Backup and restore the .n8n folder
With this method, you can transfer the entire configuration (workflows, credentials and settings) between two instances.
Where is the .n8n folder located?
- CLI installation (npm or binary): The folder is usually in the home directory of the user running n8n, for example
/root/.n8nor/home/<user>/.n8n. - Docker installation: The folder is located in the container at the location
/home/node/.n8n. In most Docker Compose configurations, it is mounted in a volume namedn8n_dataor in a folder on the VPS (e.g./root/n8n_data:/home/node/.n8n).
Check its location with:
Step 1 - Save the folder .n8n
Create the archive directly from the host system:
Create an archive of the .n8n folder:
Step 2 - Transfer the archive to the target VPS
Send the file to your target VPS:
Connect via SSH to your target VPS:
Step 3 - Restore the archive on the target VPS
On your target VPS, restore the archive in the .n8n folder of the container:
Step 4 - Restart n8n
Restart n8n:
This method requires that the encryption key (encryptionKey) is identical between the two instances. Check or copy this setting from your source instance’s configuration file.
Points to note
After migration, if the domain or subdomain changes (e.g. n8n.mydomain.com → n8n.ovh.net), update:
- The
N8N_HOSTvariable in yourdocker-compose.ymlfile. - Your DNS zone so that the subdomain points to the IP address of the new VPS.
To find out more, read our guide Modifying an OVHcloud DNS zone.
Conclusion
You now have two methods for migrating your n8n workflows and credentials to an OVHcloud VPS (or from OVHcloud to another environment):
- Export/Import via CLI: simple and selective.
- Backup
.n8n: full, ideal for a full migration.
For more information, please refer to the official n8n documentation.
Go further
How to install n8n on an OVHcloud VPS
Join our community of users.