Backup Database Instance

Hello community! How are you doing?

I wanted to ask you if it is possible from N8N to generate a backup of the complete database of the instance, in my case Postgres, through some flow or node.

Thank you very much as always, have a nice week!


Hi @Internalit_Automatio, all good here, hope you’re having a good day as well?

n8n does not offer a full database export/backup option in itself I am afraid. You can, however, use the CLI to export both your workflows and credentials. This would be documented on CLI commands | n8n Docs

For a full export of a Postgres database you’d typically use pg_dump instead. In theory you can call this tool through n8n’s Execute Command node. Depending on how you have deployed n8n you might need to run through extra steps to make it available to n8n though (such as creating a custom Dockerfile installing it). Once pg_dump is available you could run a workflow like this:

This example will write a full DB export to your hard drive using the default .sql file format:


Keep in mind that other n8n instances would not be able to read the credentials in this backup unless they use the same encryptionKey (which can be found it the config file inside your .n8n directory).
Hope this helps!

Hello @MutedJam

Thank you very much for the prompt reply. I am trying to run the command but it tells me I have denied permissions, is there any way to run root on the node? I have the instance in K8s, not with docker.


Hi @Internalit_Automatio, which command exactly is returning the error for you? Is this one of the CLI commands? If so, you might need to run your kubectl command with the sudo prefix.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.