Skip to main content

Automatic Start and Stop Scheduler for AWS RDS

Project description

CDK RDS Scheduler Construct

View on Construct Hub

This is a CDK construct for creating a schedule to periodically start and stop RDS (Aurora) clusters or instances. It can be used to reduce billing outside of operational hours.

Architecture

Open in Visual Studio Code npm version Build Status Release Status License npm downloads

Usage

Install it via npm:

npm install cdk-rds-scheduler

Then use it in your CDK stack:

import { RdsScheduler, Cron } from 'cdk-rds-scheduler';
import { TimeZone } from 'aws-cdk-lib/core';

// for DatabaseCluster
declare const databaseCluster: rds.DatabaseCluster;

new RdsScheduler(this, 'RdsClusterScheduler', {
  cluster: databaseCluster,
  schedule: [
    // Operate only during daytime on weekdays
    {
          start: new Cron({ minute: '0', hour: '8', day: '?', weekDay: 'MON-FRI' }),
          stop: new Cron({ minute: '0', hour: '18', day: '?', weekDay: 'MON-FRI' }),
      timeZone: TimeZone.ASIA_TOKYO,
    },
  ],
});

// for DatabaseInstance
declare const databaseInstance: rds.DatabaseInstance;

new RdsScheduler(this, 'RdsInstanceScheduler', {
  instance: databaseInstance,
  schedule: [
    // Put the instance into a dormant state.
    // As a measure for automatic start of Aurora, stop it every day.
    {
      stop: new Cron({ minute: '0', hour: '0', day: '?', weekDay: '*' }),
      // timeZone is optional, default is UTC
    },
  ],
});

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

rds_scheduler-1.1.5.tar.gz (75.4 kB view details)

Uploaded Source

Built Distribution

rds_scheduler-1.1.5-py3-none-any.whl (73.6 kB view details)

Uploaded Python 3

File details

Details for the file rds_scheduler-1.1.5.tar.gz.

File metadata

  • Download URL: rds_scheduler-1.1.5.tar.gz
  • Upload date:
  • Size: 75.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for rds_scheduler-1.1.5.tar.gz
Algorithm Hash digest
SHA256 81da7f0e11130b184598f4161e3e2c1b7f6b706864d10e84eaac63b2bf0021da
MD5 4bb57d3fd5f6027de33a5af8ad4f2533
BLAKE2b-256 c8634e511428631f197335a749c88b935f52988e5a0dd58db2bca2f566eb09a3

See more details on using hashes here.

File details

Details for the file rds_scheduler-1.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for rds_scheduler-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 60626f1b5efaf26cbaf9aaeb2edafecd0979a4caa78adc6af97006a5f4f66881
MD5 45def16e7b9646d90ee259b3adb00e99
BLAKE2b-256 d9710a4f20b8c5554669a8a4e13c825438cb80c5d761911ccbe94cdc1302db4a

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