Skip to content

EventSubscription

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.

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}`),
),
);