Skip to main content

AWS RDS Database Running Scheduler

Project description

AWS RDS Database Running Schedule Stack

GitHub npm (scoped) PyPI Nuget GitHub Workflow Status (branch) GitHub release (latest SemVer)

View on Construct Hub

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.

[!WARNING] v2.3.0: Stack props add option resourceNamingOption default ResourceNamingType.DEFAULT is cdk generated name f you want to maintain compatibility with versions below v2.3.0, please include the following settings (ResourceNamingType.AUTO).

new RDSDatabaseRunningScheduleStack(app, 'RDSDatabaseRunningScheduleStack', {
  targetResource: {
    tagKey: 'WorkHoursRunning',
    tagValues: ['YES'],
  },
  resourceNamingOption: {
    type: ResourceNamingType.AUTO, // HERE
  },
});

Fixed

  • RDS Aurora Cluster
  • RDS Instance

Resources

This construct creating resource list.

  • EventBridge Scheduler execution role
  • EventBridge Scheduler
  • StepFunctions StateMahcine (star or stop controle)
  • StepFunctions StateMahcine execution role

Install

TypeScript

install by npm

npm install @gammarers/aws-rds-database-running-schedule-stack

install by yarn

yarn add @gammarers/aws-rds-database-running-schedule-stack

install by pnpm

pnpm add @gammarers/aws-rds-database-running-schedule-stack

install by bun

bun add @gammarers/aws-rds-database-running-schedule-stack

Python

pip install gammarers.aws-rds-database-running-schedule-stack

C# / .NET

dotnet add package Gammarers.CDK.AWS.RdsDatabaseRunningScheduleStack

Example

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',
  },
  resourceNamingOption: {
    type: ResourceNamingType.AUTO, // DEFAULT or AUTO or CUSTOM
  },
});

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file gammarers_aws_rds_database_running_schedule_stack-2.3.1.tar.gz.

File metadata

File hashes

Hashes for gammarers_aws_rds_database_running_schedule_stack-2.3.1.tar.gz
Algorithm Hash digest
SHA256 20a2f454fd024b71ef245373b8944a6250270560dc7d7aa9dfa7da4d3d11dd3d
MD5 972b8e1af07c6639f0c82e0d982e8f89
BLAKE2b-256 3aa2050ce79c9ce7db3f3109b571ba577be9c757b8c982ec13dd84b5b8cb715c

See more details on using hashes here.

File details

Details for the file gammarers.aws_rds_database_running_schedule_stack-2.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gammarers.aws_rds_database_running_schedule_stack-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c145f590b885f0f5c3f9d575ef1c872d55177c076fbe20aaa37f1eb971ef310
MD5 66746e78bfab95c05a7086819c80c757
BLAKE2b-256 7cae4f71f6b4198e496e5f85392e7a899bc7ccf2254cb264d27e5d359a385053

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page