How to migrate an n8n configuration between two VPS

Knowledge Base

How to migrate an n8n configuration between two VPS


Icons/System/eye-open Created with Sketch. 133 Views 23.09.2025 Cloud / Virtual private servers

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

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 with docker exec.

Step 1 - Log in to the source VPS

Open a terminal and connect via SSH to your VPS on which n8n is installed:

ssh <user>@<IP_VPS_SOURCE>

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:

n8n export:workflow --all --output=workflows.json

Identify the name of your n8n container (default is n8n):

docker ps

Run the following command to generate the file inside the container:

docker exec -it n8n n8n export:workflow --all --output=/home/node/workflows.json

Sample output:

Import export n8n

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

docker cp n8n:/home/node/workflows.json /root/workflows.json

Sample output:

Import export n8n

Step 3 - Export credentials

Run the following command to export all decrypted credentials to a JSON file:

n8n export:credentials --all --decrypted --output=credentials.json

Run this command in the n8n container to generate the decrypted credentials file:

docker exec -it n8n n8n export:credentials --all --decrypted --output=/home/node/credentials.json

Sample output:

Import export n8n

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:

docker cp n8n:/home/node/credentials.json /root/credentials.json

Sample output:

Import export n8n

Step 4 - Transfer the exported files

Copy the generated files (workflows.json and credentials.json) to your target VPS:

scp workflows.json credentials.json <user>@<TARGET_VPS_IP>:/root/

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:

ssh <user>@<TARGET_VPS_IP>
n8n import:workflow --input=workflows.json
docker exec -it n8n n8n import:workflow --input=/home/node/workflows.json

Step 6 - Import credentials

n8n import:credentials --input=credentials.json
docker exec -it n8n n8n import:credentials --input=/home/node/credentials.json

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/.n8n or /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 named n8n_data or in a folder on the VPS (e.g. /root/n8n_data:/home/node/.n8n).

Check its location with:

docker exec -it n8n ls -lah /home/node/.n8n
docker inspect n8n | grep -A 5 Mounts

Step 1 - Save the folder .n8n

Create the archive directly from the host system:

tar czvf n8n-backup.tar.gz /root/.n8n

Create an archive of the .n8n folder:

docker exec n8n tar czvf - /home/node/.n8n > n8n-backup.tar.gz

Step 2 - Transfer the archive to the target VPS

Send the file to your target VPS:

scp n8n-backup.tar.gz <user>@<TARGET_VPS_IP>:/root/

Connect via SSH to your target VPS:

ssh <user>@<TARGET_VPS_IP>

Step 3 - Restore the archive on the target VPS

On your target VPS, restore the archive in the .n8n folder of the container:

docker exec -i n8n sh -c 'tar xzvf - -C /home/node/.n8n' < n8n-backup.tar.gz

Step 4 - Restart n8n

Restart n8n:

docker start 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.comn8n.ovh.net), update:

  • The N8N_HOST variable in your docker-compose.yml file.
  • 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.

Related articles