> For the complete documentation index, see [llms.txt](https://docs.storware.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.storware.eu/protecting-applications/applications/postgresql.md).

# PostgreSQL

To create a new application for PostgreSQL database backup, go to the tab: **Applications -> Instances**

Then select the **Create** button. The Creating an Application Definition section will be displayed, which needs to be completed.

This is a description of how your script is going to be invoked - you need to specify:

* **Name** - unique name of the application in the Storware Backup & Recovery system.
* **Choose Node Config** - select which node should perform the task.
* **Backup policy** - specify which backup policy should be used for this application.
* **Command execution configuration** - select a prepared template for PostgreSQL backup or create a [new](/administration/applications/execution-configurations.md) one yourself.

In the SSH access subtab, complete the following fields:

* **Host** - set the address of the host where the PostgreSQL instance exists.
* **Port** - set the host port.

Next, select OS Credentials or create a new one and provide the following information:

* **Name** - unique name of the OS Credentials.
* **User** - indicate a user for SSH connection.
* **Password** - enter the connection password.
* **SSH key path** - alternatively, you can specify the SSH key path for authorization.

After saving the application configuration, define the following environment variables:

#### Environment Variables

<table data-search="false"><thead><tr><th>Variable</th><th>Value</th><th>Description</th></tr></thead><tbody><tr><td><code>VP_SQL_USER</code></td><td><em>string</em></td><td>PostgreSQL login username.</td></tr><tr><td><code>VP_SQL_COMPRESS</code></td><td><code>yes</code> / <code>no</code></td><td>Compresses the backup on the PostgreSQL server.</td></tr><tr><td><code>VP_SQL_PASSWORD</code></td><td><em>string</em></td><td>Password for the PostgreSQL database user.</td></tr><tr><td><code>VP_SQL_LOGFILE</code></td><td><em>string</em></td><td>Path on the PostgreSQL server for the backup job log file.</td></tr><tr><td><code>VP_SQL_DBLIST</code></td><td><em>string</em></td><td>Database names to back up. Separate multiple names with commas.</td></tr><tr><td><code>VP_SQL_STOREPATH</code></td><td><em>string</em></td><td>Path on the PostgreSQL server for the temporary backup file. <strong>Use this directory only for Storware Backup &#x26; Recovery</strong>, as it is cleaned after each backup.</td></tr><tr><td><code>VP_SQL_SCRIPTPATH</code></td><td><em>string</em></td><td>Path to the backup script on the PostgreSQL host. Copy the appropriate script from <code>/opt/vprotect/server/scripts/application</code> to the database host. Then specify its destination path here.</td></tr></tbody></table>

{% hint style="info" %}
**Note:** After the new application is fully configured, **save** the changes and go to the [Backup SLAs](/administration/applications/backup-slas.md) configuration.
{% endhint %}
