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

# Redshift: VPC endpoint + username/password

> Connect Delphina to a private Redshift cluster or workgroup through a Redshift-managed VPC endpoint using a database username and password

export const timeout_0 = "Confirm the grant to Delphina's account is active, and that the port is in a supported range."

Use this setup when your Redshift endpoint is private and you'd rather use a database password than an IAM role. You grant Delphina's AWS account access to your workgroup or cluster, and Delphina connects over AWS's private network.

Part of the [Redshift Connection Guide](/administration/redshift). Not sure which setup you need? Start there.

## Before you start

Ask your Delphina contact for:

* Delphina's AWS account ID, and confirmation that Delphina can create an endpoint in your AWS region.
* A secure way to share the database password.

You also need a Redshift superuser (Steps 2 and 3).

Each step has **Serverless** and **Provisioned** tabs where they differ. Serverless endpoints contain `redshift-serverless` (`<workgroup>.<account>.<region>.redshift-serverless.amazonaws.com`); provisioned endpoints look like `<cluster>.<id>.<region>.redshift.amazonaws.com`.

## Step 1: Set up the network path

<Tabs>
  <Tab title="Serverless">
    Requirements:

    * The workgroup port must be in the range **5431–5455** or **8191–8215**. The default, 5439, qualifies.

    Steps:

    1. In the Redshift console, open your workgroup → **Data access** → **Granted accounts** → **Grant access**.
    2. Enter the Delphina AWS account ID (and VPC ID, if you want to restrict access to one VPC) from your Delphina contact.
    3. Tell your Delphina contact once it's granted. We create the endpoint on our side and confirm when it's connected.
  </Tab>

  <Tab title="Provisioned">
    Requirements:

    * An **RA3** or **RG** cluster with **cluster relocation** turned on, or a **Multi-AZ** deployment. DC2 clusters can't use a VPC endpoint; see [DC2 clusters](/administration/redshift#dc2-clusters) for your options, including an [SSH tunnel](/administration/redshift/ssh-tunnel).
    * The cluster port must be in the range **5431–5455** or **8191–8215**. The default, 5439, qualifies.

    Steps:

    1. In the Redshift console, open your cluster → **Properties** → **Granted accounts** → **Grant access**.
    2. Enter the Delphina AWS account ID (and VPC ID, if you want to restrict access to one VPC) from your Delphina contact.
    3. Tell your Delphina contact once it's granted. We create the endpoint on our side and confirm when it's connected.

    You can also grant access from the CLI:

    ```bash theme={null}
    aws redshift authorize-endpoint-access \
      --cluster-identifier <CLUSTER_ID> \
      --account <DELPHINA_ACCOUNT_ID>
    ```
  </Tab>
</Tabs>

## Step 2: Grant database access

Run this as a superuser, such as the admin user created with your workgroup or cluster, connected to **the database Delphina will use**: the one you send us in Step 4. A Delphina connection reads one database.

Use a superuser if you can. A non-superuser needs the `CREATE ROLE` permission and the right to grant on every schema and table involved, either by owning them or by holding the privileges `WITH GRANT OPTION`, and can't set default privileges for other users' tables (below).

```sql theme={null}
-- Roles apply to the whole workgroup or cluster, so create it once.
CREATE ROLE delphina_role;

-- Repeat for each schema Delphina should read.
GRANT USAGE ON SCHEMA <schema_name> TO ROLE delphina_role;
GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO ROLE delphina_role;
```

**Cover tables created later.** `GRANT SELECT ON ALL TABLES` only covers tables that exist when you run it. Set default privileges **for each user that creates tables** in the schema, such as your dbt, Fivetran, or Airflow users. Redshift applies default privileges per creating user, so one statement doesn't cover everyone.

```sql theme={null}
-- Repeat for each user that creates tables in the schema.
ALTER DEFAULT PRIVILEGES FOR USER <creator_user> IN SCHEMA <schema_name>
  GRANT SELECT ON TABLES TO ROLE delphina_role;
```

**Other data sources.**

| Source | Extra grant |
| - | - |
| **Spectrum external schemas** (Glue / S3) | `GRANT USAGE ON SCHEMA <external_schema> TO ROLE delphina_role;` The IAM role attached to your cluster or namespace must already be able to read the underlying Glue tables and S3 data (and Lake Formation, if you use it). |
| **Datashares** (consumer database) | To read a datashare, send its consumer database as the database in Step 4. Then run `GRANT USAGE ON DATABASE <consumer_database> TO ROLE delphina_role;` If the database was created `WITH PERMISSIONS`, also grant access to its objects: `GRANT USAGE ON SCHEMA <consumer_database>.<schema> TO ROLE delphina_role;` and `GRANT SELECT ON ALL TABLES IN SCHEMA <consumer_database>.<schema> TO ROLE delphina_role;` |

**Give Delphina access to query history.** Delphina learns which tables, joins, and metrics matter from how your team queries them. By default, a non-superuser only sees its own queries in Redshift's query history, so grant the built-in monitoring role. Run this once; it isn't per database.

```sql theme={null}
GRANT ROLE sys:monitor TO ROLE delphina_role;
```

This lets Delphina read the text of every user's queries. You can choose which users' queries Delphina uses during onboarding, but that's a setting in Delphina, not a database permission: the role can still read all of them. If some query text contains values Delphina must not be able to access, talk to your Delphina contact before granting it.

## Step 3: Create the database user

Create a database user with a strong password and give it the Delphina role. This is the same on Serverless and provisioned.

```sql theme={null}
CREATE USER delphina_user PASSWORD '<strong-password>';
GRANT ROLE delphina_role TO delphina_user;
```

Redshift passwords must be 8–64 characters with at least one uppercase letter, one lowercase letter, and one number. They can't contain `'`, `"`, `\`, `/`, `@`, or spaces.

Share the password with your Delphina contact through a secure channel, never over email or chat.

## Step 4: Send us the details

<Tabs>
  <Tab title="Serverless">
    | Detail | Example |
    | - | - |
    | Workgroup name | `analytics-wg` |
    | AWS account ID and region | `123456789012`, `us-east-1` |
    | Database | `dev` |
    | Default schema (optional) | `analytics` |
    | Network option | VPC endpoint |
    | Username (share the password separately) | `delphina_user` |
  </Tab>

  <Tab title="Provisioned">
    | Detail | Example |
    | - | - |
    | Cluster identifier | `analytics-cluster` |
    | AWS account ID and region | `123456789012`, `us-east-1` |
    | Node type | `ra3.4xlarge` |
    | Database | `dev` |
    | Default schema (optional) | `analytics` |
    | Network option | VPC endpoint |
    | Username (share the password separately) | `delphina_user` |
  </Tab>
</Tabs>

## Step 5: Verify the connection

Your Delphina contact adds the connection, runs a test query, and sends you the list of schemas Delphina can see. Check it against what you meant to grant: a missing schema usually means a missing grant, and an extra one means a grant is broader than intended.

Once the connection works, onboarding starts. Delphina reads your schema and table metadata and your team's query history to build its [context layer](/context-layer), and your Delphina contact walks you through reviewing it.

## Troubleshooting

| Problem | Fix |
| - | - |
| **Connection times out** | {timeout_0} |
| **Password authentication fails** | Confirm the username and password, and that the user wasn't created with `PASSWORD DISABLE`. |
| **Connected, but no tables visible** | Confirm `delphina_role` is granted to `delphina_user`, then check `USAGE` on the schema and `SELECT` on its tables. |
| **Tables lose access after a dbt run** | Add `ALTER DEFAULT PRIVILEGES` for the user dbt runs as, then re-run `GRANT SELECT ON ALL TABLES IN SCHEMA` to restore access to existing tables. |
| **Spectrum tables fail with a permissions error** | The IAM role attached to your cluster or namespace (not Delphina's role) needs Glue and S3 access to the external data. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.