# Connecting to a Remote Database
Source: https://docs.chain.link/chainlink-nodes/resources/connecting-to-a-remote-database

> For the complete documentation index, see [llms.txt](/llms.txt).

This guide show you how to set up a PostgreSQL database and connect your Chainlink node to it. Alternatively, you can follow the guides below:

- [Amazon AWS](https://aws.amazon.com/getting-started/tutorials/create-connect-postgresql-db/)
- [Azure](https://docs.microsoft.com/en-us/azure/postgresql/quickstart-create-server-database-portal)
- [Docker](https://docs.docker.com/samples/postgres/)
- [Google Cloud](https://cloud.google.com/community/tutorials/setting-up-postgres)

## Obtain information about your database

In order to connect to a remote database, you must obtain information about the database and the server. Note the following database details so you can use them to configure your Chainlink node later:

- Server hostname or IP
- Port
- Username
- Password
- Database name

The user must be the owner of the desired database. On first run, the migrations will create the tables necessary for the Chainlink node.

## Set Your DATABASE\_URL environment variable

Below is an example for setting the `DATABASE_URL` environment variable for your Chainlink Node's `.env` configuration file:

```text DATABASE_URL
DATABASE_URL=postgresql://[USERNAME]:[PASSWORD]@[SERVER]:[PORT]/[DATABASE]?sslmode=[SSL_MODE]
```

Change the following placeholders to their real values:

- `[USERNAME]`: The username for the database owner account.
- `[PASSWORD]`: The password for the database owner account.
- `[SERVER]`: The hostname or IP address of the database server.
- `[PORT]`: The port that the database is listening on. The default port for PostgreSQL is `5432`.
- `[DATABASE]`: The name of the database to use for the Chainlink node.
- `[SSL_MODE]`: If you are testing on a database that does not have SSL enabled, you can specify `disable` so that you don't need to go through the process of configuring SSL on your database. On a production node, set this value to `require` or `verify-full`. This requires an encrypted connection between your Chainlink node and the database. See the [PostgreSQL documentation](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-PROTECTION) to learn about the available SSL modes.