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.7.tar.gz (77.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rds_scheduler-1.1.7-py3-none-any.whl (75.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rds_scheduler-1.1.7.tar.gz
  • Upload date:
  • Size: 77.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.6

File hashes

Hashes for rds_scheduler-1.1.7.tar.gz
Algorithm Hash digest
SHA256 0551287eac998fcbe210318fb2fe144c1de4914fd0ff88b1d5a1a95316b3a701
MD5 f2b43d769010d98a126d4756cacc1b12
BLAKE2b-256 8637551ec66d419a28d76c7b1baac9a76c8e8bbc0a21775187ab136d0af9c2d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rds_scheduler-1.1.7-py3-none-any.whl
  • Upload date:
  • Size: 75.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.6

File hashes

Hashes for rds_scheduler-1.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4f70c1da319fc2c4e8032e148e85e7b51d4f64e358f2a046854dcc37f163b172
MD5 5570d16c6b5bf036f3cbaacca0a0c8e0
BLAKE2b-256 b1b439146944a656e5a29382bb93591babe85cadc38028f8447f14b05da19131

See more details on using hashes here.

Supported by

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