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
| Flag | Description |
|---|---|
-p, --port | Local port for the tunnel (default: 8122) |
-e, --endpoint-type | Endpoint to connect to: primary (read-write, default) or replica (read-only) |
--show-credentials | Show the datastore username, password, and example connection commands in the output (hidden by default) |
Examples
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:
--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:The tunnel stays open until you press
CTRL-C. Keep the terminal open while you need access to the datastore.
