> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/concepts/resources/nilus/destinations/cloud-warehouses/redshift.md).

# Redshift

[Amazon Redshift](https://docs.aws.amazon.com/redshift/) is a cloud data warehouse optimized for analytical SQL workloads. Nilus writes into Redshift tables for both batch and CDC pipelines using Redshift's PostgreSQL-compatible wire protocol, internally the `redshift://` URI is rewritten to `postgresql://` before connecting.

## Requirements

Connectivity and credentials must both be in place before the pipeline can run.

### Connectivity

* The Nilus runtime must reach the Redshift cluster endpoint (typically `<cluster>.<random>.<region>.redshift.amazonaws.com`) on TCP `5439`.
* The Redshift VPC security group must allow inbound traffic from the runtime egress IP range.
* For Redshift Serverless, the workgroup endpoint is the `<host>` to use; the rest of the URI shape is identical.

### Required parameters

| Parameter  | Required | Default        | Description                                                                             |
| ---------- | -------- | -------------- | --------------------------------------------------------------------------------------- |
| `host`     | Yes      | -              | Redshift cluster or Serverless workgroup endpoint.                                      |
| `port`     | No       | `5439`         | Redshift port.                                                                          |
| `database` | Yes      | -              | Target database.                                                                        |
| `username` | Yes      | -              | Redshift user.                                                                          |
| `password` | Yes      | -              | Password for the Redshift user.                                                         |
| `sslmode`  | No       | server default | Optional SSL mode: `disable`, `allow`, `prefer`, `require`, `verify-ca`, `verify-full`. |

### Permissions

The Redshift user needs:

* `USAGE` on the target schema.
* `CREATE` on the target schema if Nilus is expected to auto-create tables.
* `INSERT`, `UPDATE`, `DELETE`, `SELECT` on the target tables according to the configured `incremental_strategy`.
* For `merge`, define a stable distribution / sort key strategy on the target table so the reconciliation join performs.

### URI format

```
redshift://<username>:<password>@<host>:<port>/<database>?sslmode=<sslmode>
```

> **Note** Internally Nilus rewrites the scheme to `postgresql://` for the actual database connection, while still routing the load through Nilus's Redshift destination adapter. Do not use `postgresql://` directly against Redshift, since the Redshift-specific optimizations (sort-key-aware copy, region-aware staging) only kick in when the URI scheme is `redshift://`.

## Sink options

| Option                 | Required | Description                              |
| ---------------------- | -------- | ---------------------------------------- |
| `dest_table`           | Yes      | Target table in `<schema>.<table>` form. |
| `incremental_strategy` | Yes      | One of `replace`, `append`, or `merge`.  |

## Sample Nilus configs

Each example below is self-contained and uses the current Nilus pipeline shape.

### Batch ingestion

```yaml
name: nilus-redshift-batch
version: v1alpha
type: nilus
spec:
  type: batch
  compute: universe-compute
  source:
    address: dataos://postgres-source
    options:
      source_table: public.orders
  sink:
    address: dataos://redshift-destination
    options:
      dest_table: analytics.orders
      incremental_strategy: replace
```

### CDC ingestion

```yaml
spec:
  type: cdc
  compute: universe-compute
  source:
    address: dataos://mongodb-cdc
    cdc:
      collection.include.list: "retail.orders"
      topic.prefix: "orders_cdc"
  sink:
    address: dataos://redshift-destination
    options:
      dest_table: analytics.orders_cdc
      incremental_strategy: merge
```

## Behavior and capabilities

* **Compute model**: Nilus connects through Redshift's PostgreSQL-compatible SQL endpoint and submits SQL writes; the cluster's compute nodes execute the load.
* **Object model**: standard Redshift tables addressed as `<schema>.<table>`.
* **Supported pipeline modes**: `batch` and `cdc`.
* **Identifier case**: like PostgreSQL, Redshift folds unquoted identifiers to lower-case.
* **Wire protocol**: Redshift speaks PostgreSQL wire protocol but supports a subset of PG features; for example, no `RETURNING *` from `INSERT`, no full-text search, no per-row triggers. Avoid relying on PG-specific extensions in custom DDL.

## Troubleshooting

| Symptom                                     | Likely cause                                                                                                     | Resolution                                                                                                   |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `password authentication failed for user …` | Wrong credentials, IAM-managed user expired, or the password rotated upstream.                                   | Re-check credentials. For IAM-managed users, regenerate the temporary password and refresh the Nilus secret. |
| `Connection refused` / timeout              | VPC security group blocks the runtime egress IP.                                                                 | Add the runtime egress CIDR to the Redshift security group inbound rules.                                    |
| `dest_table` rejected                       | Table name is missing the schema prefix.                                                                         | Use the explicit `<schema>.<table>` form.                                                                    |
| Slow `merge` runs over large tables         | Target table lacks an appropriate `DISTKEY` / `SORTKEY` for the merge join.                                      | Add a `DISTKEY` on the merge join column and a `SORTKEY` on the high-selectivity column; rerun.              |
| Mysterious `255` columns limit error        | Redshift hard-caps tables at 1,600 columns and column names at 127 bytes. Wide source schemas can hit the limit. | Project / drop unnecessary columns upstream, or split the dataset across multiple destination tables.        |

## Related docs

* [AWS Redshift](/concepts/resources/nilus/batch/batch-sources/aws-redshift.md): companion batch source connector.
* [Optimize Sink Datasets](/concepts/resources/nilus/pipeline-optimization/optimize-sink-datasets.md): guidance on `incremental_strategy` and dataset-shape tuning.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/concepts/resources/nilus/destinations/cloud-warehouses/redshift.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
