RDS Database Running Scheduler
raw JSON → 0.1.4 verified Mon Apr 27 auth: no javascript
AWS CDK v2 construct to automatically start and stop RDS instances and Aurora clusters on a schedule using EventBridge Scheduler and a Lambda with durable execution. Current stable version is 0.1.4, released in April 2026 with active development. Key differentiator: tag-based resource targeting, configurable timezone/weekdays, optional Slack notifications via Secrets Manager, and built-in polling for desired state. Requires aws-cdk-lib ^2.232.0 and constructs ^10.5.1.
Common errors
error Cannot find module 'rds-database-running-scheduler' ↓
cause Package not installed or typo in package name
fix
Run 'npm install rds-database-running-scheduler' and verify package.json has the correct name.
error Property 'startSchedule' is missing in type '{}' ↓
cause Missing required props when instantiating the construct
fix
Provide startSchedule and stopSchedule objects with at least timezone, minute, hour, week.
error TypeError: Cannot read properties of undefined (reading 'slackToken') ↓
cause The Slack secret in Secrets Manager does not contain the expected keys
fix
Create a secret with JSON: {\"slackToken\": \"...\", \"slackChannel\": \"...\"}
Warnings
breaking Version 0.1.0 introduced the initial API with breaking changes from v0.0.0 (first release). ↓
fix Upgrade to >=0.1.0 and update construct props to match current API.
gotcha The secrets.slackSecretName must reference a Secrets Manager secret with keys 'slackToken' and 'slackChannel'. Missing these keys will cause Lambda runtime errors. ↓
fix Ensure the secret has the correct JSON structure: {\"slackToken\": \"xoxb-...\", \"slackChannel\": \"#channel\"}
gotcha The construct deploys Lambda functions that require IAM permissions to start/stop RDS instances. If the CDK deployment fails with 'Resource handler returned message: ... is not authorized', the IAM policy may be insufficient. ↓
fix Check that the Lambda execution role has rds:StartDBInstance, rds:StopDBInstance, rds:StartDBCluster, rds:StopDBCluster permissions.
gotcha EventBridge Scheduler is used; ensure the AWS account has the service-linked role for scheduler (AWSServiceRoleForAmazonScheduler). CDK may not create it automatically. ↓
fix Run: aws iam create-service-linked-role --aws-service-name scheduler.amazonaws.com
Install
npm install rds-database-running-scheduler yarn add rds-database-running-scheduler pnpm add rds-database-running-scheduler Imports
- RDSDatabaseRunningScheduler wrong
const RDSDatabaseRunningScheduler = require('rds-database-running-scheduler')correctimport { RDSDatabaseRunningScheduler } from 'rds-database-running-scheduler' - RDSDatabaseRunningScheduleStack wrong
import RDSDatabaseRunningScheduleStack from 'rds-database-running-scheduler'correctimport { RDSDatabaseRunningScheduleStack } from 'rds-database-running-scheduler' - TargetResource wrong
import { TargetResourceProps } from 'rds-database-running-scheduler'correctimport { TargetResource } from 'rds-database-running-scheduler'
Quickstart
import { App, Stack } from 'aws-cdk-lib';
import { RDSDatabaseRunningScheduler } from 'rds-database-running-scheduler';
const app = new App();
const stack = new Stack(app, 'TestStack', { env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION } });
new RDSDatabaseRunningScheduler(stack, 'RDSRunningScheduler', {
targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },
secrets: { slackSecretName: 'my/slack/webhook' },
enableScheduling: true,
startSchedule: { timezone: 'UTC', minute: '50', hour: '7', week: 'MON-FRI' },
stopSchedule: { timezone: 'UTC', minute: '5', hour: '19', week: 'MON-FRI' },
});
app.synth();