Amazon Redshift
BUILDING Destination · built and tested, not yet verified against production accounts. Contact us before relying on it.
Overview
Section titled “Overview”PortPilot loads each synced table into a Redshift table. Rows are written to an S3 staging
bucket you own, then loaded with Redshift’s COPY command using an IAM role attached to your
cluster. Nested objects and arrays go into SUPER columns. Tables and new columns are created
automatically.
On PortPilot-hosted deployments, PortPilot writes the staging files with an AWS access key you provide. With a bring-your-own-cloud deployment on AWS, it can use the job’s own IAM role instead.
Before you connect
Section titled “Before you connect”-
Create a database user and let it create tables in the target schema:
CREATE USER portpilot PASSWORD '<strong password>';GRANT CREATE, USAGE ON SCHEMA public TO portpilot;GRANT TEMP ON DATABASE <database> TO portpilot;TEMPis needed for upserts. If PortPilot writes to existing tables, grantSELECT, INSERT, DELETEon them too. -
Create a staging bucket in the cluster’s region. Add a lifecycle rule that expires objects under
pipestream-staging/after a few days (files from failed loads are kept for debugging). -
Let PortPilot write to the bucket with
s3:PutObjectands3:DeleteObjectonarn:aws:s3:::<bucket>/pipestream-staging/*:- Hosted: create an IAM user with that policy and an access key for it.
- AWS BYOC: attach the policy to the PortPilot job’s IAM role and leave the key fields empty.
-
Let Redshift read the bucket. Create an IAM role Redshift can assume, with
s3:GetObjecton the same prefix, and associate it with the cluster or workgroup. Note its ARN. -
Allow network access from the PortPilot job to the cluster endpoint (security group, port 5439).
Connect
Section titled “Connect”In the app, go to Destinations → New destination → Amazon Redshift and click Test connection after filling in:
| Field | Required | Default | Description |
|---|---|---|---|
host |
Yes | — | Cluster or workgroup endpoint hostname. |
port |
Yes | 5439 |
Port. |
database |
Yes | — | Target database. |
user |
Yes | — | The user created above. |
password |
Yes | — | Stored write-only in the data plane’s secret store. |
s3_staging_bucket |
Yes | — | Bucket for staging files. |
iam_role |
Yes | — | ARN of the role Redshift uses for COPY (s3:GetObject on the bucket). |
access_key_id |
Hosted: yes | — | Access key with put/delete on the staging prefix. Leave empty on AWS BYOC to use the job’s IAM role. |
secret_access_key |
With access_key_id |
— | Secret for the access key. Stored write-only. |
region |
No | — | Staging bucket region, e.g. us-east-1. |
The connection test writes and deletes a small object in the staging prefix to check access.
Schema
Section titled “Schema”- Tables are named after the source table or stream and created on the first load. Table and column names are stored in lower case.
- Names are lower-cased and quoted, so reserved words such as
orderoruserand names with spaces work: a source columnFirst Namelands as"first name". COPYmatches JSON keys to columns regardless of case.- New columns are added with
ALTER TABLE … ADD COLUMN. Existing columns are never changed or dropped. - No PortPilot metadata columns are added.
| PortPilot type | Destination type |
|---|---|
| integer | BIGINT |
| number | DOUBLE PRECISION |
| boolean | BOOLEAN |
| object | SUPER |
| array | SUPER |
| string | VARCHAR(65535) |
Sync behavior
Section titled “Sync behavior”| Write mode | When | What happens |
|---|---|---|
| Upsert | Tables with a primary key | COPY into a temporary table, then delete matching target rows and insert the staged ones in one transaction. Readers never see rows missing. |
| Replace | Full reads of tables without a primary key | Truncate, then COPY. |
| Append | Incremental reads of tables without a primary key | COPY. |
The staging file is deleted after a successful load.
Common gotchas
Section titled “Common gotchas”- Hosted deployments need an access key. Hosted jobs run on Google Cloud, so they can’t use an AWS role for staging. Rotate the key periodically and update the destination.
- Strings over 65,535 bytes fail the load. Long text fields (descriptions, HTML bodies) can hit this.
COPYpermission errors (S3ServiceException: Access Denied) mean the role iniam_rolecan’t read the staging prefix, or isn’t associated with the cluster.- Upserts on very large syncs delete and re-insert every changed row. Run
VACUUMon heavily updated tables, or let automatic vacuum keep up.