> ## Documentation Index
> Fetch the complete documentation index at: https://docs.instapods.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL

> Install and use PostgreSQL 14 in your pod.

PostgreSQL 14 is available as an on-demand service for your pods.

## Install

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    instapods services add my-app -s postgresql -w
    ```
  </Tab>

  <Tab title="Dashboard">
    Go to your pod's **Services** tab and click **Install** next to PostgreSQL.
  </Tab>
</Tabs>

Installation takes approximately 8–15 seconds.

## Credentials

```bash theme={null}
instapods services creds my-app -s postgresql
```

| Field    | Value            |
| -------- | ---------------- |
| Host     | `localhost`      |
| Port     | `5432`           |
| Username | `instapod`       |
| Password | (auto-generated) |
| Database | `instapod`       |

## Connecting from Your Application

### Python (psycopg2)

```python theme={null}
import psycopg2

conn = psycopg2.connect(
    host='localhost',
    port=5432,
    user='instapod',
    password='YOUR_PASSWORD',
    dbname='instapod'
)
```

### Python (SQLAlchemy)

```python theme={null}
from sqlalchemy import create_engine

engine = create_engine('postgresql://instapod:YOUR_PASSWORD@localhost:5432/instapod')
```

### Node.js

```javascript theme={null}
const { Pool } = require('pg');

const pool = new Pool({
  host: 'localhost',
  port: 5432,
  user: 'instapod',
  password: 'YOUR_PASSWORD',
  database: 'instapod'
});
```

### PHP (PDO)

```php theme={null}
$pdo = new PDO(
    'pgsql:host=localhost;port=5432;dbname=instapod',
    'instapod',
    'YOUR_PASSWORD'
);
```

## Command Line Access

SSH into your pod and use `psql`:

```bash theme={null}
instapods ssh my-app
psql -U instapod -d instapod
```

## Configuration

PostgreSQL runs with development-friendly defaults:

* Listens on `localhost:5432` only
* Default encoding: UTF-8
* Peer authentication for local socket, password for TCP
