Skip to main content
porter datastore connect creates a secure tunnel to connect to Porter-provisioned datastores from your local machine.

Prerequisites

  • You’ve logged in to the Porter CLI after running porter auth login
  • You’re connected to the correct project by running porter config set-project
  • You have a Porter-provisioned datastore (PostgreSQL, Redis, etc.)

Usage

porter datastore connect [DATASTORE_NAME] [flags]
Options:
FlagDescription
-p, --portLocal port for the tunnel (default: 8122)
-e, --endpoint-typeEndpoint to connect to: primary (read-write, default) or replica (read-only)
--show-credentialsShow the datastore username, password, and example connection commands in the output (hidden by default)

Examples

porter datastore connect my-postgres

Hiding credentials

By default, porter datastore connect hides the datastore username and password from the terminal output to prevent accidental credential leakage (for example, via screenshots, shared terminals, or pasted logs). The tunnel host, port, and database name are still printed so you can connect with a client that already has the credentials configured. When you need to view the credentials — for example, to copy them into a database client for the first time — pass --show-credentials:
porter datastore connect my-postgres --show-credentials
With --show-credentials, the output also includes an example psql or redis-cli command pre-filled with the connection details.

Connecting to your datastore

While the tunnel is running, connect using your preferred client in a separate terminal:
psql -h 127.0.0.1 -p 8122 -U postgres -d postgres
The tunnel stays open until you press CTRL-C. Keep the terminal open while you need access to the datastore.
Credentials shown with --show-credentials are sensitive. Avoid running the command in shared sessions, recorded terminals, or screen-shared environments where the output could be captured.