Skip to content

AWS.RedshiftServerless reference

Source: src/AWS/RedshiftServerless/Connect.ts

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

At deploy time it attaches the redshift-serverless:GetCredentials IAM policy on the workgroup ARN and publishes the workgroup endpoint as environment variables. At runtime it calls redshift-serverless:GetCredentials to mint short-lived credentials and returns a typed WorkgroupConnectionInfo 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 workgroup endpoint (attach it to the workgroup’s VPC, or make the workgroup publiclyAccessible). Provide the implementation with Effect.provide(AWS.RedshiftServerless.ConnectHttp).

Resolve Connection Info inside a Function

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

Drizzle over the Connection URL

const connect = yield* RedshiftServerless.Connect(workgroup, {
database: "analytics",
});
const db = yield* Drizzle.Postgres(
Effect.map(connect, (info) => info.url),
{ prepare: false },
);

Source: src/AWS/RedshiftServerless/ConvertRecoveryPointToSnapshot.ts

Runtime binding for the ConvertRecoveryPointToSnapshot operation (IAM actions redshift-serverless:ConvertRecoveryPointToSnapshot + redshift-serverless:TagResource).

Converts an automatic recovery point into a manual snapshot so it outlives the 24-hour recovery-point window. Provide the implementation with Effect.provide(AWS.RedshiftServerless.ConvertRecoveryPointToSnapshotHttp).

ConvertRecoveryPointToSnapshot: Working with Recovery Points

Section titled “ConvertRecoveryPointToSnapshot: Working with Recovery Points”
// init — resolve the runtime client
const convert = yield* AWS.RedshiftServerless.ConvertRecoveryPointToSnapshot();
yield* convert({ recoveryPointId, snapshotName: `preserved-${runId}` });

Source: src/AWS/RedshiftServerless/CreateSnapshot.ts

Runtime binding for the CreateSnapshot operation (IAM actions redshift-serverless:CreateSnapshot + redshift-serverless:TagResource).

Takes a manual snapshot of the bound Namespace — e.g. a pre-migration backup function or a scheduled snapshot-rotation job. The namespace name is injected from the binding. Provide the implementation with Effect.provide(AWS.RedshiftServerless.CreateSnapshotHttp).

// init — resolve the runtime client
const createSnapshot = yield* AWS.RedshiftServerless.CreateSnapshot(namespace);
// runtime
yield* createSnapshot({
snapshotName: `pre-migration-${runId}`,
retentionPeriod: 7,
});

Source: src/AWS/RedshiftServerless/DeleteSnapshot.ts

Runtime binding for the DeleteSnapshot operation (IAM actions redshift-serverless:DeleteSnapshot).

Deletes a manual snapshot — the cleanup half of a snapshot-rotation job. Provide the implementation with Effect.provide(AWS.RedshiftServerless.DeleteSnapshotHttp).

// init — resolve the runtime client
const deleteSnapshot = yield* AWS.RedshiftServerless.DeleteSnapshot();
yield* deleteSnapshot({ snapshotName: "pre-migration-1" });

Source: src/AWS/RedshiftServerless/GetIdentityCenterAuthToken.ts

Runtime binding for the GetIdentityCenterAuthToken operation (IAM actions redshift-serverless:GetIdentityCenterAuthToken).

Mints an IAM Identity Center authentication token for up to 20 workgroups — the trusted-identity-propagation alternative to Connect’s GetCredentials flow. The response token decodes to Redacted<string>. Provide the implementation with Effect.provide(AWS.RedshiftServerless.GetIdentityCenterAuthTokenHttp).

GetIdentityCenterAuthToken: Connecting to a Workgroup

Section titled “GetIdentityCenterAuthToken: Connecting to a Workgroup”
// init — resolve the runtime client
const getToken = yield* AWS.RedshiftServerless.GetIdentityCenterAuthToken();
const { token, expirationTime } = yield* getToken({
workgroupNames: [workgroupName],
});

Source: src/AWS/RedshiftServerless/GetRecoveryPoint.ts

Runtime binding for the GetRecoveryPoint operation (IAM actions redshift-serverless:GetRecoveryPoint).

Reads one automatic recovery point by id. Provide the implementation with Effect.provide(AWS.RedshiftServerless.GetRecoveryPointHttp).

GetRecoveryPoint: Working with Recovery Points

Section titled “GetRecoveryPoint: Working with Recovery Points”
// init — resolve the runtime client
const getRecoveryPoint = yield* AWS.RedshiftServerless.GetRecoveryPoint();
const { recoveryPoint } = yield* getRecoveryPoint({ recoveryPointId });

Source: src/AWS/RedshiftServerless/GetSnapshot.ts

Runtime binding for the GetSnapshot operation (IAM actions redshift-serverless:GetSnapshot).

Reads one snapshot by name or ARN — e.g. polling a snapshot taken with CreateSnapshot until its status reaches AVAILABLE. Provide the implementation with Effect.provide(AWS.RedshiftServerless.GetSnapshotHttp).

// init — resolve the runtime client
const getSnapshot = yield* AWS.RedshiftServerless.GetSnapshot();
const { snapshot } = yield* getSnapshot({ snapshotName: "pre-migration-1" });
// snapshot?.status -> "CREATING" | "AVAILABLE" | ...

Source: src/AWS/RedshiftServerless/GetTableRestoreStatus.ts

Runtime binding for the GetTableRestoreStatus operation (IAM actions redshift-serverless:GetTableRestoreStatus).

Polls one table-restore request started with RestoreTableFromSnapshot or RestoreTableFromRecoveryPoint. Provide the implementation with Effect.provide(AWS.RedshiftServerless.GetTableRestoreStatusHttp).

// init — resolve the runtime client
const getTableRestoreStatus = yield* AWS.RedshiftServerless.GetTableRestoreStatus();
const { tableRestoreStatus } = yield* getTableRestoreStatus({
tableRestoreRequestId,
});

Source: src/AWS/RedshiftServerless/ListRecoveryPoints.ts

Runtime binding for the ListRecoveryPoints operation (IAM actions redshift-serverless:ListRecoveryPoints).

Lists the automatic recovery points Redshift Serverless created in the last 24 hours, optionally filtered by namespace — the discovery half of point-in-time recovery tooling. Provide the implementation with Effect.provide(AWS.RedshiftServerless.ListRecoveryPointsHttp).

ListRecoveryPoints: Working with Recovery Points

Section titled “ListRecoveryPoints: Working with Recovery Points”
// init — resolve the runtime client
const listRecoveryPoints = yield* AWS.RedshiftServerless.ListRecoveryPoints();
const { recoveryPoints } = yield* listRecoveryPoints({ namespaceName });

Source: src/AWS/RedshiftServerless/ListSnapshots.ts

Runtime binding for the ListSnapshots operation (IAM actions redshift-serverless:ListSnapshots).

Lists snapshots in the account, optionally filtered by namespace or time window — the discovery half of snapshot-rotation and DR tooling. Provide the implementation with Effect.provide(AWS.RedshiftServerless.ListSnapshotsHttp).

// init — resolve the runtime client
const listSnapshots = yield* AWS.RedshiftServerless.ListSnapshots();
const { snapshots } = yield* listSnapshots({ namespaceName });

Source: src/AWS/RedshiftServerless/ListTableRestoreStatus.ts

Runtime binding for the ListTableRestoreStatus operation (IAM actions redshift-serverless:ListTableRestoreStatus).

Lists table-restore requests, optionally filtered by namespace or workgroup. Provide the implementation with Effect.provide(AWS.RedshiftServerless.ListTableRestoreStatusHttp).

// init — resolve the runtime client
const listTableRestoreStatus = yield* AWS.RedshiftServerless.ListTableRestoreStatus();
const { tableRestoreStatuses } = yield* listTableRestoreStatus({ namespaceName });

Source: src/AWS/RedshiftServerless/Namespace.ts

An Amazon Redshift Serverless namespace — the storage-and-database half of a serverless data warehouse.

A namespace holds databases, schemas, tables, admin credentials, and IAM roles. Compute is provided separately by a Workgroup that points at the namespace. Creating a namespace is quick (~1 minute); the provider waits (bounded) for it to become AVAILABLE.

Inline Admin Credentials

const namespace = yield* RedshiftServerless.Namespace("Analytics", {
dbName: "analytics",
adminUsername: "admin",
adminUserPassword: Redacted.make("SuperSecret123!"),
});

Secrets-Manager-Managed Admin Password

const namespace = yield* RedshiftServerless.Namespace("Analytics", {
dbName: "analytics",
adminUsername: "admin",
manageAdminPassword: true,
});
// namespace.adminPasswordSecretArn -> the generated secret's ARN
const namespace = yield* RedshiftServerless.Namespace("Analytics", {
dbName: "analytics",
defaultIamRoleArn: role.roleArn,
iamRoles: [role.roleArn],
kmsKeyId: key.keyId,
logExports: ["userlog", "connectionlog"],
});

Source: src/AWS/RedshiftServerless/RestoreFromRecoveryPoint.ts

Runtime binding for the RestoreFromRecoveryPoint operation (IAM actions redshift-serverless:RestoreFromRecoveryPoint).

Restores the bound Namespace from an automatic recovery point — point-in-time recovery within the last 24 hours. Provide the implementation with Effect.provide(AWS.RedshiftServerless.RestoreFromRecoveryPointHttp).

// init — resolve the runtime client
const restore = yield* AWS.RedshiftServerless.RestoreFromRecoveryPoint(namespace);
yield* restore({ workgroupName, recoveryPointId });

Source: src/AWS/RedshiftServerless/RestoreFromSnapshot.ts

Runtime binding for the RestoreFromSnapshot operation (IAM actions redshift-serverless:RestoreFromSnapshot).

Restores the bound Namespace from a snapshot — a disaster-recovery runbook step. The namespace name is injected from the binding; pass the serving workgroup and the snapshot to restore. Provide the implementation with Effect.provide(AWS.RedshiftServerless.RestoreFromSnapshotHttp).

// init — resolve the runtime client
const restoreFromSnapshot = yield* AWS.RedshiftServerless.RestoreFromSnapshot(namespace);
yield* restoreFromSnapshot({
workgroupName,
snapshotName: "pre-migration-1",
});

Source: src/AWS/RedshiftServerless/RestoreTableFromRecoveryPoint.ts

Runtime binding for the RestoreTableFromRecoveryPoint operation (IAM actions redshift-serverless:RestoreTableFromRecoveryPoint).

Restores a single table from an automatic recovery point into the bound Namespace under a new name. Provide the implementation with Effect.provide(AWS.RedshiftServerless.RestoreTableFromRecoveryPointHttp).

RestoreTableFromRecoveryPoint: Restoring Data

Section titled “RestoreTableFromRecoveryPoint: Restoring Data”
// init — resolve the runtime client
const restoreTable = yield* AWS.RedshiftServerless.RestoreTableFromRecoveryPoint(namespace);
yield* restoreTable({
workgroupName,
recoveryPointId,
sourceDatabaseName: "dev",
sourceTableName: "orders",
newTableName: "orders_restored",
});

Source: src/AWS/RedshiftServerless/RestoreTableFromSnapshot.ts

Runtime binding for the RestoreTableFromSnapshot operation (IAM actions redshift-serverless:RestoreTableFromSnapshot).

Restores a single table from a snapshot into the bound Namespace under a new name — undo for a bad table mutation without rolling back the whole namespace. Provide the implementation with Effect.provide(AWS.RedshiftServerless.RestoreTableFromSnapshotHttp).

// init — resolve the runtime client
const restoreTable = yield* AWS.RedshiftServerless.RestoreTableFromSnapshot(namespace);
yield* restoreTable({
workgroupName,
snapshotName: "pre-migration-1",
sourceDatabaseName: "dev",
sourceTableName: "orders",
newTableName: "orders_restored",
});

Source: src/AWS/RedshiftServerless/UpdateSnapshot.ts

Runtime binding for the UpdateSnapshot operation (IAM actions redshift-serverless:UpdateSnapshot).

Changes a snapshot’s retention period — e.g. extending retention on a snapshot that an audit flagged for preservation. Provide the implementation with Effect.provide(AWS.RedshiftServerless.UpdateSnapshotHttp).

// init — resolve the runtime client
const updateSnapshot = yield* AWS.RedshiftServerless.UpdateSnapshot();
yield* updateSnapshot({ snapshotName: "pre-migration-1", retentionPeriod: 30 });

Source: src/AWS/RedshiftServerless/Workgroup.ts

An Amazon Redshift Serverless workgroup — the compute half of a serverless data warehouse.

A workgroup provides on-demand compute (measured in RPUs) against a Namespace’s data. Creating a workgroup is asynchronous and takes roughly 2-5 minutes; the provider waits (bounded) for it to become AVAILABLE. Because a running workgroup bills against its RPU floor, tear it down promptly when you are done.

const namespace = yield* RedshiftServerless.Namespace("Analytics", {
adminUsername: "admin",
manageAdminPassword: true,
});
const workgroup = yield* RedshiftServerless.Workgroup("AnalyticsWg", {
namespaceName: namespace.namespaceName,
baseCapacity: 8,
});
// workgroup.endpointAddress -> "<wg>.<account>.<region>.redshift-serverless.amazonaws.com"
const workgroup = yield* RedshiftServerless.Workgroup("AnalyticsWg", {
namespaceName: namespace.namespaceName,
baseCapacity: 8,
publiclyAccessible: true,
subnetIds: [subnetA.subnetId, subnetB.subnetId, subnetC.subnetId],
securityGroupIds: [securityGroup.groupId],
enhancedVpcRouting: false,
});