N8N Workflows & Credentials Migration: Export & Import Tutorial
Discover the seamless process of transferring N8N workflows and credentials between containers and servers with this comprehensive tutorial. Whether you’re upgrading your infrastructure or moving to a new server, these step-by-step instructions will guide you through a smooth workflow migration.
Table of Contents
N8N, a powerful workflow automation tool, allows you to export and import workflows and credentials effortlessly. This tutorial will cover the essential steps to export your workflows and credentials from one N8N container, transfer them to another server, and import them seamlessly. Let’s dive in!
Efficiently import N8N workflows into your Docker container by copying exported workflow files. With just a few commands, ensure a smooth transition when migrating to a new server or replicating workflows across environments. This straightforward process maintains the integrity of your automation setup, minimizing downtime during transitions.
- List Docker Containers:
docker ps # Identify container name (e.g., n8n_container_name_1)
- Export Workflows:
docker exec -u node -it n8n_container_name_1 n8n export:workflow --all --output=pre-exported-workflows.json
- Copy Workflow Outside Container:
docker cp n8n_container_name_1:/home/node/pre-exported-workflows.json /home/user/exported-workflows.json
- Transfer to Other Server:
scp -P 22 /home/user/exported-workflows.json [email protected]:/home/user2
Safely export all your N8N credentials from a Docker container with the
n8n export:credentials command. This one-liner generates a file containing all your credentials, providing a secure way to transfer or back up sensitive information. Simplify the sharing and replication of your automation setup by exporting credentials seamlessly.
- Export All Credentials:
docker exec -u node -it n8n_container_name_1 n8n export:credentials --all --output=pre-exported-credentials.json
- Copy Credentials Outside Container:
docker cp n8n_container_name_1:/home/node/pre-exported-credentials.json /home/user/exported-credentials.json
- Transfer to Other Server:
scp -P 22 /home/user/exported-credentials.json [email protected]:/home/user2
Import Workflows & Credentials
Bringing your N8N workflows and credentials to life on a new server! This section outlines the process of importing your meticulously crafted workflows and essential credentials, ensuring a flawless transition:
- Copy Workflow Inside Container:
sudo docker cp /home/user/n8n/exported-workflow.json n8n_container_name_2:/home/node/exported-workflows.json
- Copy Credentials Inside Container:
sudo docker cp /home/user/n8n/exported-credentials.json n8n_container_name_2:/home/node/exported-credentials.json
- Import Credentials:
sudo docker exec -u node -it n8n_container_name_2 n8n import:credentials --input=exported-credentials.json
- Import Workflows:
sudo docker exec -u node -it n8n_container_name_2 n8n import:workflow --input=exported-workflows.json
During the migration process, it is crucial to copy the encryption key from the old server’s
.n8n/config to the new server. This key is essential for ensuring that the transferred credentials work seamlessly on the new server. Failing to copy the encryption key may result in authentication issues and disruptions to your workflow processes.
Copy Encryption Key: Copy the encryption key from the old server’s
.n8n/config to the new server. This step is crucial for the credentials to work on the new server.
- List Contents in Container:
The helper command
docker exec n8n_container_name_1 ls / is used to list files and folders within your N8N container. This command provides a quick overview of the container’s contents, allowing you to navigate and access specific files needed for export, import, or troubleshooting purposes.
docker exec n8n_container_name_1 ls /
Embark on a hassle-free N8N workflow migration journey with this tutorial, ensuring your automation processes remain uninterrupted during server transitions.