Skip to content
GitHubXDiscord

ScheduledAction

The ScheduledAction resource allows you to manage AWS Redshift Scheduled Actions which automate the management of your clusters. You can schedule actions like resizing clusters or pausing them during non-usage periods.

Create a basic scheduled action that pauses a Redshift cluster during the night.

import AWS from "alchemy/aws/control";
const scheduledAction = await AWS.Redshift.ScheduledAction("nightlyPauseAction", {
ScheduledActionName: "PauseClusterAtNight",
ScheduledActionDescription: "This action pauses the Redshift cluster every night at 11 PM.",
Schedule: "cron(0 23 * * ? *)",
TargetAction: {
PauseCluster: {
ClusterIdentifier: "my-redshift-cluster"
}
},
Enable: true
});

Configure a scheduled action to resize a Redshift cluster during the weekend.

const resizeAction = await AWS.Redshift.ScheduledAction("weekendResizeAction", {
ScheduledActionName: "ResizeClusterOnWeekends",
ScheduledActionDescription: "This action resizes the Redshift cluster every Saturday at 2 AM.",
Schedule: "cron(0 2 ? * 7 *)",
TargetAction: {
ResizeCluster: {
ClusterIdentifier: "my-redshift-cluster",
NodeCount: 4
}
},
Enable: true
});

Create a scheduled action that enables a cluster during business hours and disables it afterward.

const businessHoursAction = await AWS.Redshift.ScheduledAction("businessHoursAction", {
ScheduledActionName: "EnableClusterDuringBusinessHours",
ScheduledActionDescription: "This action enables the cluster from 8 AM to 6 PM on weekdays.",
Schedule: "cron(0 8 ? * MON-FRI *)",
TargetAction: {
ResumeCluster: {
ClusterIdentifier: "my-redshift-cluster"
}
},
Enable: true
});
const disableClusterAction = await AWS.Redshift.ScheduledAction("disableClusterAction", {
ScheduledActionName: "DisableClusterAfterBusinessHours",
ScheduledActionDescription: "This action disables the cluster after business hours.",
Schedule: "cron(0 18 ? * MON-FRI *)",
TargetAction: {
PauseCluster: {
ClusterIdentifier: "my-redshift-cluster"
}
},
Enable: true
});