Skip to content

AWS.Redshift reference

Source: src/AWS/Redshift/Cluster.ts

A provisioned Amazon Redshift data-warehouse cluster.

Clusters take roughly 5-10 minutes to provision and are billed hourly per node while they exist (ra3.large and dc2.large are the smallest node types). For serverless data warehousing see the RedshiftServerless namespace instead. Destroy clusters you are not using.

Single-Node Cluster

const cluster = yield* Redshift.Cluster("Warehouse", {
nodeType: "ra3.large",
numberOfNodes: 1,
masterUsername: "admin",
masterUserPassword: warehousePassword,
dbName: "analytics",
});

Cluster in a VPC Subnet Group

const subnetGroup = yield* Redshift.ClusterSubnetGroup("WarehouseSubnets", {
subnetIds: [subnetA.subnetId, subnetB.subnetId],
});
const cluster = yield* Redshift.Cluster("Warehouse", {
nodeType: "ra3.large",
numberOfNodes: 2,
masterUsername: "admin",
manageMasterPassword: true,
clusterSubnetGroupName: subnetGroup.clusterSubnetGroupName,
publiclyAccessible: false,
encrypted: true,
});

Source: src/AWS/Redshift/ClusterParameterGroup.ts

An Amazon Redshift cluster parameter group — a named set of database parameters applied to provisioned Redshift clusters.

Parameter groups are free and provision instantly. A Cluster references one by name via clusterParameterGroupName; parameter changes take effect after the cluster reboots.

ClusterParameterGroup: Creating a Parameter Group

Section titled “ClusterParameterGroup: Creating a Parameter Group”

Default Parameter Group

const params = yield* Redshift.ClusterParameterGroup("WarehouseParams", {
family: "redshift-2.0",
});

Overriding Parameters

const params = yield* Redshift.ClusterParameterGroup("WarehouseParams", {
family: "redshift-2.0",
parameters: {
enable_user_activity_logging: "true",
statement_timeout: "60000",
},
});

Source: src/AWS/Redshift/ClusterSubnetGroup.ts

An Amazon Redshift cluster subnet group — the set of VPC subnets a provisioned Redshift cluster’s nodes are placed into.

Subnet groups are free and provision instantly. A Cluster references one by name via clusterSubnetGroupName.

ClusterSubnetGroup: Creating a Cluster Subnet Group

Section titled “ClusterSubnetGroup: Creating a Cluster Subnet Group”

Subnet Group Spanning Two Subnets

const subnetGroup = yield* Redshift.ClusterSubnetGroup("WarehouseSubnets", {
description: "Subnets for the analytics warehouse",
subnetIds: [subnetA.subnetId, subnetB.subnetId],
});

Tagged Subnet Group

const subnetGroup = yield* Redshift.ClusterSubnetGroup("WarehouseSubnets", {
subnetIds: [subnetA.subnetId, subnetB.subnetId],
tags: { team: "analytics" },
});

Source: src/AWS/Redshift/Connect.ts

Runtime binding that resolves pgwire connection settings for a provisioned Redshift Cluster using IAM-minted temporary database credentials.

At deploy time it attaches the redshift:GetClusterCredentials[WithIAM] IAM policy (scoped to the cluster’s dbname/dbuser ARNs) and publishes the cluster endpoint as environment variables. At runtime it calls the corresponding SDK operation to mint short-lived credentials and returns a typed ClusterConnectionInfo whose url feeds Drizzle.Postgres directly.

The Redshift Data API (RedshiftData.Statements) remains the recommended default — it needs no driver, no VPC reach, and no credential plumbing. Use Connect when you want a real pgwire connection (e.g. Drizzle). Redshift speaks the postgres wire protocol on port 5439 — configure Drizzle with prepare: false and avoid RETURNING (Redshift does not support either). The host Function must be able to reach the cluster endpoint (attach it to the cluster’s VPC, or make the cluster publiclyAccessible). Provide the implementation with Effect.provide(AWS.Redshift.ConnectHttp).

Resolve Connection Info inside a Function (IAM identity)

const connect = yield* Redshift.Connect(cluster);
// inside a handler — mints fresh temporary credentials:
const { host, port, username, password, url } = yield* connect;

Connect as a Named Database User

const connect = yield* Redshift.Connect(cluster, {
dbUser: "etl",
autoCreate: true,
dbGroups: ["analysts"],
database: "analytics",
});

Drizzle over the Connection URL

const connect = yield* Redshift.Connect(cluster);
const db = yield* Drizzle.Postgres(
Effect.map(connect, (info) => info.url),
{ prepare: false },
);

Source: src/AWS/Redshift/CopyClusterSnapshot.ts

Runtime binding for the CopyClusterSnapshot operation (IAM action redshift:CopyClusterSnapshot).

Copies an automated cluster snapshot to a manual one so it survives the automated retention window — e.g. an archival job that preserves the nightly snapshot before a risky migration. Provide the implementation with Effect.provide(AWS.Redshift.CopyClusterSnapshotHttp).

const copyClusterSnapshot = yield* AWS.Redshift.CopyClusterSnapshot();
yield* copyClusterSnapshot({
SourceSnapshotIdentifier: nightly.SnapshotIdentifier!,
TargetSnapshotIdentifier: `archive-${runId}`,
});

Source: src/AWS/Redshift/CreateClusterSnapshot.ts

Runtime binding for the CreateClusterSnapshot operation (IAM action redshift:CreateClusterSnapshot on the cluster and its snapshot:{cluster}/* ARNs).

Takes a manual snapshot of the bound Cluster — e.g. a pre-migration backup function or a scheduled snapshot-rotation job. The cluster identifier is injected from the binding. Provide the implementation with Effect.provide(AWS.Redshift.CreateClusterSnapshotHttp).

// init — bind the operation to the cluster
const createClusterSnapshot =
yield* AWS.Redshift.CreateClusterSnapshot(cluster);
// runtime
yield* createClusterSnapshot({
SnapshotIdentifier: `pre-migration-${runId}`,
});

Source: src/AWS/Redshift/DeleteClusterSnapshot.ts

Runtime binding for the DeleteClusterSnapshot operation (IAM action redshift:DeleteClusterSnapshot).

Deletes a manual cluster snapshot by identifier — the cleanup half of a snapshot-rotation job (automated snapshots cannot be deleted; they expire with the retention period). Provide the implementation with Effect.provide(AWS.Redshift.DeleteClusterSnapshotHttp).

const deleteClusterSnapshot = yield* AWS.Redshift.DeleteClusterSnapshot();
yield* deleteClusterSnapshot({
SnapshotIdentifier: expired.SnapshotIdentifier!,
});

Source: src/AWS/Redshift/DescribeClusters.ts

Runtime binding for the DescribeClusters operation (IAM action redshift:DescribeClusters).

Lists the account’s provisioned Redshift clusters or looks one up by identifier — e.g. an ops function that checks whether the warehouse is available before submitting a load. Provide the implementation with Effect.provide(AWS.Redshift.DescribeClustersHttp).

const describeClusters = yield* AWS.Redshift.DescribeClusters();
const page = yield* describeClusters({ ClusterIdentifier: clusterId });
const status = page.Clusters?.[0]?.ClusterStatus;

Source: src/AWS/Redshift/DescribeClusterSnapshots.ts

Runtime binding for the DescribeClusterSnapshots operation (IAM action redshift:DescribeClusterSnapshots).

Lists the account’s cluster snapshots (manual and automated) — e.g. a snapshot-rotation job that finds manual snapshots older than the retention window before deleting them. Provide the implementation with Effect.provide(AWS.Redshift.DescribeClusterSnapshotsHttp).

DescribeClusterSnapshots: Managing Snapshots

Section titled “DescribeClusterSnapshots: Managing Snapshots”
const describeClusterSnapshots =
yield* AWS.Redshift.DescribeClusterSnapshots();
const page = yield* describeClusterSnapshots({
ClusterIdentifier: clusterId,
SnapshotType: "manual",
});
const identifiers = page.Snapshots?.map((s) => s.SnapshotIdentifier);

Source: src/AWS/Redshift/DescribeEvents.ts

Runtime binding for the DescribeEvents operation (IAM action redshift:DescribeEvents).

Lists recent events (maintenance, resizes, snapshots, security changes) for the account’s Redshift clusters and related resources over the last 14 days — the audit trail for operational tooling. For push delivery of the same events see EventSubscription. Provide the implementation with Effect.provide(AWS.Redshift.DescribeEventsHttp).

const describeEvents = yield* AWS.Redshift.DescribeEvents();
const page = yield* describeEvents({
SourceIdentifier: clusterId,
SourceType: "cluster",
});
const messages = page.Events?.map((e) => e.Message);

Source: src/AWS/Redshift/EventSubscription.ts

An Amazon Redshift event notification subscription — routes provisioned cluster lifecycle events (maintenance, resizes, snapshots, failures, security changes) to an SNS topic.

SNS is Redshift’s native event channel for provisioned clusters: the only events Redshift publishes directly to EventBridge are the zero-ETL integration detail-types, so cluster events reach compute through an EventSubscriptionSNS.TopicSNS.consumeTopicNotifications chain. Subscriptions are free and provision instantly.

EventSubscription: Subscribing to Cluster Events

Section titled “EventSubscription: Subscribing to Cluster Events”

Route Cluster Events to an SNS Topic

const alerts = yield* SNS.Topic("WarehouseAlerts", {});
const subscription = yield* Redshift.EventSubscription("WarehouseEvents", {
snsTopicArn: alerts.topicArn,
sourceType: "cluster",
sourceIds: [cluster.clusterIdentifier],
});

Only Error-Severity Monitoring Events

const subscription = yield* Redshift.EventSubscription("WarehouseErrors", {
snsTopicArn: alerts.topicArn,
eventCategories: ["monitoring"],
severity: "ERROR",
});

Consume the Events in a Function

// inside a Lambda Function definition:
yield* SNS.consumeTopicNotifications(alerts, (messages) =>
Stream.runForEach(messages, (message) =>
Effect.logInfo(`redshift event: ${message.Message}`),
),
);

Source: src/AWS/Redshift/PauseCluster.ts

Runtime binding for the PauseCluster operation (IAM action redshift:PauseCluster).

Pauses the bound Cluster (compute billing stops, storage persists) — e.g. a scheduled ops function that parks the warehouse overnight to save cost. The cluster identifier is injected from the binding. Provide the implementation with Effect.provide(AWS.Redshift.PauseClusterHttp).

// init — bind the operation to the cluster
const pauseCluster = yield* AWS.Redshift.PauseCluster(cluster);
// runtime
yield* pauseCluster();

Source: src/AWS/Redshift/RebootCluster.ts

Runtime binding for the RebootCluster operation (IAM action redshift:RebootCluster).

Reboots the bound Cluster (a momentary outage while it restarts) — e.g. an ops function that applies pending static parameter-group changes. The cluster identifier is injected from the binding. Provide the implementation with Effect.provide(AWS.Redshift.RebootClusterHttp).

// init — bind the operation to the cluster
const rebootCluster = yield* AWS.Redshift.RebootCluster(cluster);
// runtime
yield* rebootCluster();

Source: src/AWS/Redshift/ResumeCluster.ts

Runtime binding for the ResumeCluster operation (IAM action redshift:ResumeCluster).

Resumes the bound paused Cluster — the morning half of an overnight pause schedule. The cluster identifier is injected from the binding. Provide the implementation with Effect.provide(AWS.Redshift.ResumeClusterHttp).

// init — bind the operation to the cluster
const resumeCluster = yield* AWS.Redshift.ResumeCluster(cluster);
// runtime
yield* resumeCluster();