This AWS CDK Construct Stack controls the starting and stopping of RDS DB instances and clusters based on specified tags, ensuring they only run during working hours. It uses EventBridge Scheduler to trigger a StepFunctions State Machine at the start and end of the working hours(default 07:50(UTC) - 21:10(UTC)), which then starts or stops the databases depending on the mode.
- RDS Aurora Cluster
- RDS Instance
This construct creating resource list.
- EventBridge Scheduler execution role
- EventBridge Scheduler
- StepFunctions StateMahcine (star or stop controle)
- StepFunctions StateMahcine execution role
npm install @gammarers/aws-rds-database-running-schedule-stack
yarn add @gammarers/aws-rds-database-running-schedule-stack
pnpm add @gammarers/aws-rds-database-running-schedule-stack
bun add @gammarers/aws-rds-database-running-schedule-stack
pip install gammarers.aws-rds-database-running-schedule-stack
dotnet add package Gammarers.CDK.AWS.RdsDatabaseRunningScheduleStack
import { RdsDatabaseRunningScheduler, DatabaseType } from '@gammarer/aws-rds-database-running-schedule-stack';
new RDSDatabaseRunningScheduleStack(app, 'RDSDatabaseRunningScheduleStack', {
targetResource: {
tagKey: 'WorkHoursRunning', // already tagging to rds instance or cluster
tagValues: ['YES'], // already tagging to rds instance or cluster
},
enableScheduling: true,
startSchedule: {
timezone: 'Asia/Tokyo',
minute: '55',
hour: '8',
week: 'MON-FRI',
},
stopSchedule: {
timezone: 'Asia/Tokyo',
minute: '5',
hour: '19',
week: 'MON-FRI',
},
});
This project is licensed under the Apache-2.0 License.