AWS.RedshiftServerless reference
Connect
Section titled “Connect”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).
Connect: Connecting to a Workgroup
Section titled “Connect: Connecting to a Workgroup”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 },);ConvertRecoveryPointToSnapshot
Section titled “ConvertRecoveryPointToSnapshot”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 clientconst convert = yield* AWS.RedshiftServerless.ConvertRecoveryPointToSnapshot();
yield* convert({ recoveryPointId, snapshotName: `preserved-${runId}` });CreateSnapshot
Section titled “CreateSnapshot”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).
CreateSnapshot: Managing Snapshots
Section titled “CreateSnapshot: Managing Snapshots”// init — resolve the runtime clientconst createSnapshot = yield* AWS.RedshiftServerless.CreateSnapshot(namespace);
// runtimeyield* createSnapshot({ snapshotName: `pre-migration-${runId}`, retentionPeriod: 7,});DeleteSnapshot
Section titled “DeleteSnapshot”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).
DeleteSnapshot: Managing Snapshots
Section titled “DeleteSnapshot: Managing Snapshots”// init — resolve the runtime clientconst deleteSnapshot = yield* AWS.RedshiftServerless.DeleteSnapshot();
yield* deleteSnapshot({ snapshotName: "pre-migration-1" });GetIdentityCenterAuthToken
Section titled “GetIdentityCenterAuthToken”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 clientconst getToken = yield* AWS.RedshiftServerless.GetIdentityCenterAuthToken();
const { token, expirationTime } = yield* getToken({ workgroupNames: [workgroupName],});GetRecoveryPoint
Section titled “GetRecoveryPoint”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 clientconst getRecoveryPoint = yield* AWS.RedshiftServerless.GetRecoveryPoint();
const { recoveryPoint } = yield* getRecoveryPoint({ recoveryPointId });GetSnapshot
Section titled “GetSnapshot”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).
GetSnapshot: Managing Snapshots
Section titled “GetSnapshot: Managing Snapshots”// init — resolve the runtime clientconst getSnapshot = yield* AWS.RedshiftServerless.GetSnapshot();
const { snapshot } = yield* getSnapshot({ snapshotName: "pre-migration-1" });// snapshot?.status -> "CREATING" | "AVAILABLE" | ...GetTableRestoreStatus
Section titled “GetTableRestoreStatus”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).
GetTableRestoreStatus: Restoring Data
Section titled “GetTableRestoreStatus: Restoring Data”// init — resolve the runtime clientconst getTableRestoreStatus = yield* AWS.RedshiftServerless.GetTableRestoreStatus();
const { tableRestoreStatus } = yield* getTableRestoreStatus({ tableRestoreRequestId,});ListRecoveryPoints
Section titled “ListRecoveryPoints”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 clientconst listRecoveryPoints = yield* AWS.RedshiftServerless.ListRecoveryPoints();
const { recoveryPoints } = yield* listRecoveryPoints({ namespaceName });ListSnapshots
Section titled “ListSnapshots”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).
ListSnapshots: Managing Snapshots
Section titled “ListSnapshots: Managing Snapshots”// init — resolve the runtime clientconst listSnapshots = yield* AWS.RedshiftServerless.ListSnapshots();
const { snapshots } = yield* listSnapshots({ namespaceName });ListTableRestoreStatus
Section titled “ListTableRestoreStatus”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).
ListTableRestoreStatus: Restoring Data
Section titled “ListTableRestoreStatus: Restoring Data”// init — resolve the runtime clientconst listTableRestoreStatus = yield* AWS.RedshiftServerless.ListTableRestoreStatus();
const { tableRestoreStatuses } = yield* listTableRestoreStatus({ namespaceName });Namespace
Section titled “Namespace”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.
Namespace: Creating a Namespace
Section titled “Namespace: Creating a Namespace”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 ARNNamespace: IAM Roles and Encryption
Section titled “Namespace: IAM Roles and Encryption”const namespace = yield* RedshiftServerless.Namespace("Analytics", { dbName: "analytics", defaultIamRoleArn: role.roleArn, iamRoles: [role.roleArn], kmsKeyId: key.keyId, logExports: ["userlog", "connectionlog"],});RestoreFromRecoveryPoint
Section titled “RestoreFromRecoveryPoint”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).
RestoreFromRecoveryPoint: Restoring Data
Section titled “RestoreFromRecoveryPoint: Restoring Data”// init — resolve the runtime clientconst restore = yield* AWS.RedshiftServerless.RestoreFromRecoveryPoint(namespace);
yield* restore({ workgroupName, recoveryPointId });RestoreFromSnapshot
Section titled “RestoreFromSnapshot”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).
RestoreFromSnapshot: Restoring Data
Section titled “RestoreFromSnapshot: Restoring Data”// init — resolve the runtime clientconst restoreFromSnapshot = yield* AWS.RedshiftServerless.RestoreFromSnapshot(namespace);
yield* restoreFromSnapshot({ workgroupName, snapshotName: "pre-migration-1",});RestoreTableFromRecoveryPoint
Section titled “RestoreTableFromRecoveryPoint”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 clientconst restoreTable = yield* AWS.RedshiftServerless.RestoreTableFromRecoveryPoint(namespace);
yield* restoreTable({ workgroupName, recoveryPointId, sourceDatabaseName: "dev", sourceTableName: "orders", newTableName: "orders_restored",});RestoreTableFromSnapshot
Section titled “RestoreTableFromSnapshot”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).
RestoreTableFromSnapshot: Restoring Data
Section titled “RestoreTableFromSnapshot: Restoring Data”// init — resolve the runtime clientconst restoreTable = yield* AWS.RedshiftServerless.RestoreTableFromSnapshot(namespace);
yield* restoreTable({ workgroupName, snapshotName: "pre-migration-1", sourceDatabaseName: "dev", sourceTableName: "orders", newTableName: "orders_restored",});UpdateSnapshot
Section titled “UpdateSnapshot”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).
UpdateSnapshot: Managing Snapshots
Section titled “UpdateSnapshot: Managing Snapshots”// init — resolve the runtime clientconst updateSnapshot = yield* AWS.RedshiftServerless.UpdateSnapshot();
yield* updateSnapshot({ snapshotName: "pre-migration-1", retentionPeriod: 30 });Workgroup
Section titled “Workgroup”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.
Workgroup: Creating a Workgroup
Section titled “Workgroup: Creating a Workgroup”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"Workgroup: Networking
Section titled “Workgroup: Networking”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,});