rds-database-running-scheduler 0.3.7 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii CHANGED
@@ -8440,7 +8440,7 @@
8440
8440
  "stability": "stable"
8441
8441
  },
8442
8442
  "homepage": "https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler.git",
8443
- "jsiiVersion": "6.0.12 (build 471f453)",
8443
+ "jsiiVersion": "6.0.13 (build 5c05d06)",
8444
8444
  "keywords": [
8445
8445
  "aurora",
8446
8446
  "aws",
@@ -8463,7 +8463,7 @@
8463
8463
  },
8464
8464
  "name": "rds-database-running-scheduler",
8465
8465
  "readme": {
8466
- "markdown": "# RDS Database Running Scheduler (AWS CDK v2)\n\n[![GitHub](https://img.shields.io/github/license/gammarers-aws-cdk-constructs/rds-database-running-scheduler?style=flat-square)](https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler/blob/main/LICENSE)\n[![npm version](https://img.shields.io/npm/v/rds-database-running-scheduler?style=flat-square)](https://www.npmjs.com/package/rds-database-running-scheduler)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-constructs/rds-database-running-scheduler/release.yml?branch=main&label=release&style=flat-square)](https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler/actions/workflows/release.yml)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/gammarers-aws-cdk-constructs/rds-database-running-scheduler?sort=semver&style=flat-square)](https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler/releases)\n\n[![View on Construct Hub](https://constructs.dev/badge?package=rds-database-running-scheduler)](https://constructs.dev/packages/rds-database-running-scheduler)\n\nThis AWS CDK construct controls the start and stop of RDS DB instances and Aurora clusters based on resource tags. EventBridge Scheduler invokes a durable Lambda function on a cron schedule so databases run only during defined working hours. The Lambda discovers tagged resources account-wide via the Resource Groups Tagging API, deduplicates Aurora cluster member instances when the parent cluster is also tagged, and controls each remaining resource using the region encoded in its ARN. Slack notifications are optional via `notification.slack`. Default schedule: start 07:50 UTC, stop 19:05 UTC, Monday–Friday.\n\n## Features\n\n- **Tag-based targeting**: Start and stop RDS DB instances and Aurora clusters that match a given tag key and values.\n- **Account-wide discovery**: Finds tagged RDS resources across all regions in the deployment account.\n- **Cluster-priority deduplication**: When tag discovery returns both an Aurora cluster and its member DB instances, only the cluster is processed to avoid conflicting start/stop operations.\n- **Region-aware RDS control**: Creates per-region RDS clients from each resource ARN so cross-region resources are handled correctly.\n- **EventBridge Scheduler**: Cron-based start and stop schedules with configurable timezone, time, and weekdays.\n- **Lambda with Durable Execution**: A single durable run discovers resources by tag, starts or stops them, and polls until they reach the desired state (with timeout).\n- **Optional Slack notifications**: Set `notification.slack` to post schedule progress and per-resource results to Slack via Secrets Manager. Omit `notification` (or `notification.slack`) to skip secret lookup, Slack API calls, and related IAM grants.\n- **Supported resources**: RDS DB instances and RDS Aurora clusters.\n\n## Installation\n\n**npm**\n\n```bash\nnpm install rds-database-running-scheduler\n```\n\n**yarn**\n\n```bash\nyarn add rds-database-running-scheduler\n```\n\n## Usage\n\nUse the **Construct** `RDSDatabaseRunningScheduler` when adding the scheduler into an existing Stack or any CDK scope.\n\nWith Slack notifications:\n\n```typescript\nimport { TimeZone } from 'aws-cdk-lib';\nimport { RDSDatabaseRunningScheduler } from 'rds-database-running-scheduler';\n\nnew RDSDatabaseRunningScheduler(scope, 'RDSDatabaseRunningScheduler', {\n targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },\n notification: { slack: { secretName: 'example/slack/webhook' } },\n enableScheduling: true,\n startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },\n stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },\n});\n```\n\nWithout Slack notifications, omit `notification` (or omit `notification.slack`):\n\n```typescript\nnew RDSDatabaseRunningScheduler(scope, 'RDSDatabaseRunningScheduler', {\n targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },\n enableScheduling: true,\n startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },\n stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },\n});\n```\n\nUse the **Stack** `RDSDatabaseRunningScheduleStack` when you want a dedicated Stack that only contains the scheduler. Both accept the same props.\n\n```typescript\nimport { App, TimeZone } from 'aws-cdk-lib';\nimport { RDSDatabaseRunningScheduleStack } from 'rds-database-running-scheduler';\n\nconst app = new App();\n\nnew RDSDatabaseRunningScheduleStack(app, 'RDSDatabaseRunningScheduleStack', {\n targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },\n notification: { slack: { secretName: 'example/slack/webhook' } },\n enableScheduling: true,\n startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },\n stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },\n});\n```\n\nTag your RDS instances or Aurora clusters with the same `tagKey` and one of the `tagValues` so they are included in the schedule.\n\nFor Aurora, tagging the cluster is sufficient. If member DB instances inherit the same tag, the Lambda automatically excludes them when the parent cluster is also targeted, so cluster-level start/stop is applied once without conflicting instance-level operations.\n\nWhen `notification.slack` is set, the secret in AWS Secrets Manager must contain JSON with `token` and `channel` fields:\n\n```json\n{\n \"token\": \"xoxb-...\",\n \"channel\": \"C0123456789\"\n}\n```\n\n## Options\n\n| Option | Type | Required | Description |\n|--------|------|----------|-------------|\n| `targetResource` | `TargetResource` | Yes | Tag key and values used to select RDS resources. |\n| `notification` | `Notification` | No | Notification channels. Set `notification.slack` to enable Slack. Omit to disable notifications. |\n| `enableScheduling` | `boolean` | No | Whether start and stop schedules are enabled. Default: `true`. |\n| `startSchedule` | `Schedule` | No | Start schedule. Default: 07:50 UTC, MON–FRI. |\n| `stopSchedule` | `Schedule` | No | Stop schedule. Default: 19:05 UTC, MON–FRI. |\n\n### Schedule\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `timezone` | `TimeZone` | Yes | CDK timezone constant (for example `TimeZone.ASIA_TOKYO`, `TimeZone.ETC_UTC`). |\n| `minute` | `string` | No | Cron minute (for example `'50'`). |\n| `hour` | `string` | No | Cron hour (for example `'7'`, `'19'`). |\n| `week` | `string` | No | Cron week day (for example `'MON-FRI'`). |\n\n### TargetResource\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `tagKey` | `string` | Yes | Tag key to filter RDS resources. |\n| `tagValues` | `string[]` | Yes | Tag values to match (resources with any of these values are targeted). |\n\n### Notification\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `slack` | `SlackNotification` | No | Presence enables Slack notifications. |\n\n### SlackNotification\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `secretName` | `string` | Yes | Secrets Manager secret name containing Slack `token` and `channel`. |\n\n## Requirements\n\n- **Node.js**: >= 20.0.0\n- **AWS CDK**: ^2.232.0\n- **constructs**: ^10.5.1\n- **AWS**: Account and region with permissions to create EventBridge Scheduler, Lambda, IAM, and CloudWatch Logs; RDS describe/start/stop permissions for targeted resources; Resource Groups Tagging API access for resource discovery. Secrets Manager access is required only when `notification.slack` is set.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
8466
+ "markdown": "# RDS Database Running Scheduler (AWS CDK v2)\n\n[![GitHub](https://img.shields.io/github/license/gammarers-aws-cdk-constructs/rds-database-running-scheduler?style=flat-square)](https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler/blob/main/LICENSE)\n[![npm version](https://img.shields.io/npm/v/rds-database-running-scheduler?style=flat-square)](https://www.npmjs.com/package/rds-database-running-scheduler)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-constructs/rds-database-running-scheduler/release.yml?branch=main&label=release&style=flat-square)](https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler/actions/workflows/release.yml)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/gammarers-aws-cdk-constructs/rds-database-running-scheduler?sort=semver&style=flat-square)](https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler/releases)\n\n[![View on Construct Hub](https://constructs.dev/badge?package=rds-database-running-scheduler)](https://constructs.dev/packages/rds-database-running-scheduler)\n\nThis AWS CDK construct controls the start and stop of RDS DB instances and Aurora clusters based on resource tags. EventBridge Scheduler invokes a durable Lambda function on a cron schedule so databases run only during defined working hours. The Lambda discovers tagged resources account-wide via the Resource Groups Tagging API, deduplicates Aurora cluster member instances when the parent cluster is also tagged, and controls each remaining resource using the region encoded in its ARN. Slack notifications are optional via `notification.slack.enable` (default `false`). Default schedule: start 07:50 UTC, stop 19:05 UTC, Monday–Friday.\n\n## Features\n\n- **Tag-based targeting**: Start and stop RDS DB instances and Aurora clusters that match a given tag key and values.\n- **Account-wide discovery**: Finds tagged RDS resources across all regions in the deployment account.\n- **Cluster-priority deduplication**: When tag discovery returns both an Aurora cluster and its member DB instances, only the cluster is processed to avoid conflicting start/stop operations.\n- **Region-aware RDS control**: Creates per-region RDS clients from each resource ARN so cross-region resources are handled correctly.\n- **EventBridge Scheduler**: Cron-based start and stop schedules with configurable timezone, time, and weekdays.\n- **Lambda with Durable Execution**: A single durable run discovers resources by tag, starts or stops them, and polls until they reach the desired state (with timeout).\n- **Optional Slack notifications**: Set `notification.slack.enable` to `true` and provide `secretName` to post schedule progress and per-resource results to Slack via Secrets Manager. Leave `enable` unset (default `false`), set it to `false`, or omit `notification.slack` to skip secret lookup, Slack API calls, and related IAM grants.\n- **Supported resources**: RDS DB instances and RDS Aurora clusters.\n\n## Installation\n\n**npm**\n\n```bash\nnpm install rds-database-running-scheduler\n```\n\n**yarn**\n\n```bash\nyarn add rds-database-running-scheduler\n```\n\n## Usage\n\nUse the **Construct** `RDSDatabaseRunningScheduler` when adding the scheduler into an existing Stack or any CDK scope.\n\nWith Slack notifications:\n\n```typescript\nimport { TimeZone } from 'aws-cdk-lib';\nimport { RDSDatabaseRunningScheduler } from 'rds-database-running-scheduler';\n\nnew RDSDatabaseRunningScheduler(scope, 'RDSDatabaseRunningScheduler', {\n targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },\n notification: { slack: { enable: true, secretName: 'example/slack/webhook' } },\n enableScheduling: true,\n startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },\n stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },\n});\n```\n\nWithout Slack notifications, omit `notification` (or set `notification.slack.enable` to `false`):\n\n```typescript\nnew RDSDatabaseRunningScheduler(scope, 'RDSDatabaseRunningScheduler', {\n targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },\n enableScheduling: true,\n startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },\n stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },\n});\n```\n\nUse the **Stack** `RDSDatabaseRunningScheduleStack` when you want a dedicated Stack that only contains the scheduler. Both accept the same props.\n\n```typescript\nimport { App, TimeZone } from 'aws-cdk-lib';\nimport { RDSDatabaseRunningScheduleStack } from 'rds-database-running-scheduler';\n\nconst app = new App();\n\nnew RDSDatabaseRunningScheduleStack(app, 'RDSDatabaseRunningScheduleStack', {\n targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },\n notification: { slack: { enable: true, secretName: 'example/slack/webhook' } },\n enableScheduling: true,\n startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },\n stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },\n});\n```\n\nTag your RDS instances or Aurora clusters with the same `tagKey` and one of the `tagValues` so they are included in the schedule.\n\nFor Aurora, tagging the cluster is sufficient. If member DB instances inherit the same tag, the Lambda automatically excludes them when the parent cluster is also targeted, so cluster-level start/stop is applied once without conflicting instance-level operations.\n\nWhen Slack is enabled, the secret in AWS Secrets Manager must contain JSON with `token` and `channel` fields:\n\n```json\n{\n \"token\": \"xoxb-...\",\n \"channel\": \"C0123456789\"\n}\n```\n\n## Options\n\n| Option | Type | Required | Description |\n|--------|------|----------|-------------|\n| `targetResource` | `TargetResource` | Yes | Tag key and values used to select RDS resources. |\n| `notification` | `Notification` | No | Notification channels. Set `notification.slack.enable` to `true` to send Slack messages. |\n| `enableScheduling` | `boolean` | No | Whether start and stop schedules are enabled. Default: `true`. |\n| `startSchedule` | `Schedule` | No | Start schedule. Default: 07:50 UTC, MON–FRI. |\n| `stopSchedule` | `Schedule` | No | Stop schedule. Default: 19:05 UTC, MON–FRI. |\n\n### Schedule\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `timezone` | `TimeZone` | Yes | CDK timezone constant (for example `TimeZone.ASIA_TOKYO`, `TimeZone.ETC_UTC`). |\n| `minute` | `string` | No | Cron minute (for example `'50'`). |\n| `hour` | `string` | No | Cron hour (for example `'7'`, `'19'`). |\n| `week` | `string` | No | Cron week day (for example `'MON-FRI'`). |\n\n### TargetResource\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `tagKey` | `string` | Yes | Tag key to filter RDS resources. |\n| `tagValues` | `string[]` | Yes | Tag values to match (resources with any of these values are targeted). |\n\n### Notification\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `slack` | `SlackNotification` | No | Slack settings. Omit, or set `enable` to `false`, to disable Slack. |\n\n### SlackNotification\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `enable` | `boolean` | No | Enable Slack notifications. Default: `false`. When `false`, secret lookup, Slack API calls, and IAM grants are skipped. |\n| `secretName` | `string` | No | Secrets Manager secret name containing Slack `token` and `channel`. Required when `enable` is `true`. |\n\n## Requirements\n\n- **Node.js**: >= 20.0.0\n- **AWS CDK**: ^2.232.0\n- **constructs**: ^10.5.1\n- **AWS**: Account and region with permissions to create EventBridge Scheduler, Lambda, IAM, and CloudWatch Logs; RDS describe/start/stop permissions for targeted resources. Start/stop IAM is scoped to DB instance and cluster ARNs in the account and to `aws:ResourceTag` matching `targetResource`. Resource Groups Tagging API access is required for resource discovery. Secrets Manager access is required only when Slack notifications are enabled.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
8467
8467
  },
8468
8468
  "repository": {
8469
8469
  "type": "git",
@@ -8488,21 +8488,21 @@
8488
8488
  "kind": "interface",
8489
8489
  "locationInModule": {
8490
8490
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8491
- "line": 49
8491
+ "line": 58
8492
8492
  },
8493
8493
  "name": "Notification",
8494
8494
  "properties": [
8495
8495
  {
8496
8496
  "abstract": true,
8497
8497
  "docs": {
8498
- "remarks": "Presence enables Slack.",
8498
+ "remarks": "Set `slack.enable` to `true` to send messages.",
8499
8499
  "stability": "stable",
8500
8500
  "summary": "Optional Slack notification settings."
8501
8501
  },
8502
8502
  "immutable": true,
8503
8503
  "locationInModule": {
8504
8504
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8505
- "line": 51
8505
+ "line": 60
8506
8506
  },
8507
8507
  "name": "slack",
8508
8508
  "optional": true,
@@ -8529,7 +8529,7 @@
8529
8529
  },
8530
8530
  "locationInModule": {
8531
8531
  "filename": "src/stacks/rds-database-running-schedule-stack.ts",
8532
- "line": 40
8532
+ "line": 39
8533
8533
  },
8534
8534
  "parameters": [
8535
8535
  {
@@ -8552,7 +8552,7 @@
8552
8552
  },
8553
8553
  {
8554
8554
  "docs": {
8555
- "summary": "Stack configuration, including optional notification channels."
8555
+ "summary": "Stack configuration, including optional Slack notification settings."
8556
8556
  },
8557
8557
  "name": "props",
8558
8558
  "type": {
@@ -8564,7 +8564,7 @@
8564
8564
  "kind": "class",
8565
8565
  "locationInModule": {
8566
8566
  "filename": "src/stacks/rds-database-running-schedule-stack.ts",
8567
- "line": 32
8567
+ "line": 31
8568
8568
  },
8569
8569
  "name": "RDSDatabaseRunningScheduleStack",
8570
8570
  "symbolId": "src/stacks/rds-database-running-schedule-stack:RDSDatabaseRunningScheduleStack"
@@ -8613,7 +8613,7 @@
8613
8613
  "immutable": true,
8614
8614
  "locationInModule": {
8615
8615
  "filename": "src/stacks/rds-database-running-schedule-stack.ts",
8616
- "line": 18
8616
+ "line": 17
8617
8617
  },
8618
8618
  "name": "enableScheduling",
8619
8619
  "optional": true,
@@ -8624,14 +8624,14 @@
8624
8624
  {
8625
8625
  "abstract": true,
8626
8626
  "docs": {
8627
- "remarks": "Set `notification.slack` to enable Slack; omit it to skip secret lookup,\nSlack API calls, and related IAM grants.",
8627
+ "remarks": "Set `notification.slack.enable` to `true` and provide `secretName` to send Slack messages.",
8628
8628
  "stability": "stable",
8629
8629
  "summary": "Optional notification channels."
8630
8630
  },
8631
8631
  "immutable": true,
8632
8632
  "locationInModule": {
8633
8633
  "filename": "src/stacks/rds-database-running-schedule-stack.ts",
8634
- "line": 16
8634
+ "line": 15
8635
8635
  },
8636
8636
  "name": "notification",
8637
8637
  "optional": true,
@@ -8648,7 +8648,7 @@
8648
8648
  "immutable": true,
8649
8649
  "locationInModule": {
8650
8650
  "filename": "src/stacks/rds-database-running-schedule-stack.ts",
8651
- "line": 22
8651
+ "line": 21
8652
8652
  },
8653
8653
  "name": "startSchedule",
8654
8654
  "optional": true,
@@ -8665,7 +8665,7 @@
8665
8665
  "immutable": true,
8666
8666
  "locationInModule": {
8667
8667
  "filename": "src/stacks/rds-database-running-schedule-stack.ts",
8668
- "line": 20
8668
+ "line": 19
8669
8669
  },
8670
8670
  "name": "stopSchedule",
8671
8671
  "optional": true,
@@ -8680,7 +8680,7 @@
8680
8680
  "assembly": "rds-database-running-scheduler",
8681
8681
  "base": "constructs.Construct",
8682
8682
  "docs": {
8683
- "remarks": "The Lambda discovers matching resources account-wide via the Resource Groups\nTagging API, deduplicates Aurora cluster member instances when the parent\ncluster is also tagged, and controls each remaining resource using the\nregion encoded in its ARN. When `notification.slack` is set, the Lambda\nposts progress and results to Slack; otherwise Secrets Manager lookup,\nSlack API calls, and related IAM grants are skipped.",
8683
+ "remarks": "The Lambda discovers matching resources account-wide via the Resource Groups\nTagging API, deduplicates Aurora cluster member instances when the parent\ncluster is also tagged, and controls each remaining resource using the\nregion encoded in its ARN. When Slack is enabled, the Lambda posts progress\nand results to Slack; otherwise Secrets Manager lookup, Slack API calls,\nand related IAM grants are skipped.",
8684
8684
  "stability": "stable",
8685
8685
  "summary": "CDK construct that provisions a durable Lambda workflow and EventBridge schedules to start/stop tagged RDS databases and clusters."
8686
8686
  },
@@ -8692,7 +8692,7 @@
8692
8692
  },
8693
8693
  "locationInModule": {
8694
8694
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8695
- "line": 93
8695
+ "line": 148
8696
8696
  },
8697
8697
  "parameters": [
8698
8698
  {
@@ -8715,7 +8715,7 @@
8715
8715
  },
8716
8716
  {
8717
8717
  "docs": {
8718
- "summary": "Scheduler configuration, including optional notification channels."
8718
+ "summary": "Scheduler configuration, including optional Slack notification settings."
8719
8719
  },
8720
8720
  "name": "props",
8721
8721
  "type": {
@@ -8727,7 +8727,7 @@
8727
8727
  "kind": "class",
8728
8728
  "locationInModule": {
8729
8729
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8730
- "line": 85
8730
+ "line": 140
8731
8731
  },
8732
8732
  "name": "RDSDatabaseRunningScheduler",
8733
8733
  "symbolId": "src/constructs/rds-database-running-scheduler:RDSDatabaseRunningScheduler"
@@ -8743,7 +8743,7 @@
8743
8743
  "kind": "interface",
8744
8744
  "locationInModule": {
8745
8745
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8746
- "line": 57
8746
+ "line": 66
8747
8747
  },
8748
8748
  "name": "RDSDatabaseRunningSchedulerProps",
8749
8749
  "properties": [
@@ -8756,7 +8756,7 @@
8756
8756
  "immutable": true,
8757
8757
  "locationInModule": {
8758
8758
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8759
- "line": 59
8759
+ "line": 68
8760
8760
  },
8761
8761
  "name": "targetResource",
8762
8762
  "type": {
@@ -8773,7 +8773,7 @@
8773
8773
  "immutable": true,
8774
8774
  "locationInModule": {
8775
8775
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8776
- "line": 61
8776
+ "line": 70
8777
8777
  },
8778
8778
  "name": "enableScheduling",
8779
8779
  "optional": true,
@@ -8784,14 +8784,14 @@
8784
8784
  {
8785
8785
  "abstract": true,
8786
8786
  "docs": {
8787
- "remarks": "Set `notification.slack` to enable Slack; omit it to skip secret lookup,\nSlack API calls, and related IAM grants.",
8787
+ "remarks": "Set `notification.slack.enable` to `true` and provide `secretName` to send Slack messages.",
8788
8788
  "stability": "stable",
8789
8789
  "summary": "Optional notification channels."
8790
8790
  },
8791
8791
  "immutable": true,
8792
8792
  "locationInModule": {
8793
8793
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8794
- "line": 67
8794
+ "line": 75
8795
8795
  },
8796
8796
  "name": "notification",
8797
8797
  "optional": true,
@@ -8808,7 +8808,7 @@
8808
8808
  "immutable": true,
8809
8809
  "locationInModule": {
8810
8810
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8811
- "line": 71
8811
+ "line": 79
8812
8812
  },
8813
8813
  "name": "startSchedule",
8814
8814
  "optional": true,
@@ -8825,7 +8825,7 @@
8825
8825
  "immutable": true,
8826
8826
  "locationInModule": {
8827
8827
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8828
- "line": 69
8828
+ "line": 77
8829
8829
  },
8830
8830
  "name": "stopSchedule",
8831
8831
  "optional": true,
@@ -8925,7 +8925,7 @@
8925
8925
  "assembly": "rds-database-running-scheduler",
8926
8926
  "datatype": true,
8927
8927
  "docs": {
8928
- "remarks": "Providing this object (via `notification.slack`) enables Slack notifications.",
8928
+ "remarks": "Notifications are off unless `enable` is `true`.",
8929
8929
  "stability": "stable",
8930
8930
  "summary": "Slack notification settings."
8931
8931
  },
@@ -8940,15 +8940,36 @@
8940
8940
  {
8941
8941
  "abstract": true,
8942
8942
  "docs": {
8943
+ "default": "false",
8944
+ "remarks": "When `false`, Secrets Manager lookup, Slack API calls, and related IAM grants are skipped.",
8945
+ "stability": "stable",
8946
+ "summary": "Whether Slack notifications are enabled."
8947
+ },
8948
+ "immutable": true,
8949
+ "locationInModule": {
8950
+ "filename": "src/constructs/rds-database-running-scheduler.ts",
8951
+ "line": 45
8952
+ },
8953
+ "name": "enable",
8954
+ "optional": true,
8955
+ "type": {
8956
+ "primitive": "boolean"
8957
+ }
8958
+ },
8959
+ {
8960
+ "abstract": true,
8961
+ "docs": {
8962
+ "remarks": "Required when `enable` is `true`.",
8943
8963
  "stability": "stable",
8944
8964
  "summary": "Name of the Slack API secret in AWS Secrets Manager (`token` and `channel`)."
8945
8965
  },
8946
8966
  "immutable": true,
8947
8967
  "locationInModule": {
8948
8968
  "filename": "src/constructs/rds-database-running-scheduler.ts",
8949
- "line": 41
8969
+ "line": 50
8950
8970
  },
8951
8971
  "name": "secretName",
8972
+ "optional": true,
8952
8973
  "type": {
8953
8974
  "primitive": "string"
8954
8975
  }
@@ -9012,6 +9033,6 @@
9012
9033
  "symbolId": "src/constructs/rds-database-running-scheduler:TargetResource"
9013
9034
  }
9014
9035
  },
9015
- "version": "0.3.7",
9016
- "fingerprint": "rYZ3l23DFVXVb/N6P7Jo3AaXSdocngLmqJnmujV/M9E="
9036
+ "version": "0.4.1",
9037
+ "fingerprint": "SndfBWAok8vLgefGT5Y8XB6HvS2nLQwi9xAcgKv085I="
9017
9038
  }
package/API.md CHANGED
@@ -9,9 +9,9 @@ CDK construct that provisions a durable Lambda workflow and EventBridge schedule
9
9
  The Lambda discovers matching resources account-wide via the Resource Groups
10
10
  Tagging API, deduplicates Aurora cluster member instances when the parent
11
11
  cluster is also tagged, and controls each remaining resource using the
12
- region encoded in its ARN. When `notification.slack` is set, the Lambda
13
- posts progress and results to Slack; otherwise Secrets Manager lookup,
14
- Slack API calls, and related IAM grants are skipped.
12
+ region encoded in its ARN. When Slack is enabled, the Lambda posts progress
13
+ and results to Slack; otherwise Secrets Manager lookup, Slack API calls,
14
+ and related IAM grants are skipped.
15
15
 
16
16
  #### Initializers <a name="Initializers" id="rds-database-running-scheduler.RDSDatabaseRunningScheduler.Initializer"></a>
17
17
 
@@ -25,7 +25,7 @@ new RDSDatabaseRunningScheduler(scope: Construct, id: string, props: RDSDatabase
25
25
  | --- | --- | --- |
26
26
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduler.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | Parent construct scope. |
27
27
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduler.Initializer.parameter.id">id</a></code> | <code>string</code> | Construct identifier. |
28
- | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduler.Initializer.parameter.props">props</a></code> | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps">RDSDatabaseRunningSchedulerProps</a></code> | Scheduler configuration, including optional notification channels. |
28
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduler.Initializer.parameter.props">props</a></code> | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps">RDSDatabaseRunningSchedulerProps</a></code> | Scheduler configuration, including optional Slack notification settings. |
29
29
 
30
30
  ---
31
31
 
@@ -49,7 +49,7 @@ Construct identifier.
49
49
 
50
50
  - *Type:* <a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps">RDSDatabaseRunningSchedulerProps</a>
51
51
 
52
- Scheduler configuration, including optional notification channels.
52
+ Scheduler configuration, including optional Slack notification settings.
53
53
 
54
54
  ---
55
55
 
@@ -171,7 +171,7 @@ new RDSDatabaseRunningScheduleStack(scope: Construct, id: string, props: RDSData
171
171
  | --- | --- | --- |
172
172
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStack.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | Parent construct scope. |
173
173
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStack.Initializer.parameter.id">id</a></code> | <code>string</code> | Stack identifier. |
174
- | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStack.Initializer.parameter.props">props</a></code> | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps">RDSDatabaseRunningScheduleStackProps</a></code> | Stack configuration, including optional notification channels. |
174
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStack.Initializer.parameter.props">props</a></code> | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps">RDSDatabaseRunningScheduleStackProps</a></code> | Stack configuration, including optional Slack notification settings. |
175
175
 
176
176
  ---
177
177
 
@@ -195,7 +195,7 @@ Stack identifier.
195
195
 
196
196
  - *Type:* <a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps">RDSDatabaseRunningScheduleStackProps</a>
197
197
 
198
- Stack configuration, including optional notification channels.
198
+ Stack configuration, including optional Slack notification settings.
199
199
 
200
200
  ---
201
201
 
@@ -1147,7 +1147,7 @@ public readonly slack: SlackNotification;
1147
1147
 
1148
1148
  Optional Slack notification settings.
1149
1149
 
1150
- Presence enables Slack.
1150
+ Set `slack.enable` to `true` to send messages.
1151
1151
 
1152
1152
  ---
1153
1153
 
@@ -1211,8 +1211,7 @@ public readonly notification: Notification;
1211
1211
 
1212
1212
  Optional notification channels.
1213
1213
 
1214
- Set `notification.slack` to enable Slack; omit it to skip secret lookup,
1215
- Slack API calls, and related IAM grants.
1214
+ Set `notification.slack.enable` to `true` and provide `secretName` to send Slack messages.
1216
1215
 
1217
1216
  ---
1218
1217
 
@@ -1556,8 +1555,7 @@ public readonly notification: Notification;
1556
1555
 
1557
1556
  Optional notification channels.
1558
1557
 
1559
- Set `notification.slack` to enable Slack; omit it to skip secret lookup,
1560
- Slack API calls, and related IAM grants.
1558
+ Set `notification.slack.enable` to `true` and provide `secretName` to send Slack messages.
1561
1559
 
1562
1560
  ---
1563
1561
 
@@ -1660,7 +1658,7 @@ Weekday field in cron expression.
1660
1658
 
1661
1659
  Slack notification settings.
1662
1660
 
1663
- Providing this object (via `notification.slack`) enables Slack notifications.
1661
+ Notifications are off unless `enable` is `true`.
1664
1662
 
1665
1663
  #### Initializer <a name="Initializer" id="rds-database-running-scheduler.SlackNotification.Initializer"></a>
1666
1664
 
@@ -1674,11 +1672,27 @@ const slackNotification: SlackNotification = { ... }
1674
1672
 
1675
1673
  | **Name** | **Type** | **Description** |
1676
1674
  | --- | --- | --- |
1675
+ | <code><a href="#rds-database-running-scheduler.SlackNotification.property.enable">enable</a></code> | <code>boolean</code> | Whether Slack notifications are enabled. |
1677
1676
  | <code><a href="#rds-database-running-scheduler.SlackNotification.property.secretName">secretName</a></code> | <code>string</code> | Name of the Slack API secret in AWS Secrets Manager (`token` and `channel`). |
1678
1677
 
1679
1678
  ---
1680
1679
 
1681
- ##### `secretName`<sup>Required</sup> <a name="secretName" id="rds-database-running-scheduler.SlackNotification.property.secretName"></a>
1680
+ ##### `enable`<sup>Optional</sup> <a name="enable" id="rds-database-running-scheduler.SlackNotification.property.enable"></a>
1681
+
1682
+ ```typescript
1683
+ public readonly enable: boolean;
1684
+ ```
1685
+
1686
+ - *Type:* boolean
1687
+ - *Default:* false
1688
+
1689
+ Whether Slack notifications are enabled.
1690
+
1691
+ When `false`, Secrets Manager lookup, Slack API calls, and related IAM grants are skipped.
1692
+
1693
+ ---
1694
+
1695
+ ##### `secretName`<sup>Optional</sup> <a name="secretName" id="rds-database-running-scheduler.SlackNotification.property.secretName"></a>
1682
1696
 
1683
1697
  ```typescript
1684
1698
  public readonly secretName: string;
@@ -1688,6 +1702,8 @@ public readonly secretName: string;
1688
1702
 
1689
1703
  Name of the Slack API secret in AWS Secrets Manager (`token` and `channel`).
1690
1704
 
1705
+ Required when `enable` is `true`.
1706
+
1691
1707
  ---
1692
1708
 
1693
1709
  ### TargetResource <a name="TargetResource" id="rds-database-running-scheduler.TargetResource"></a>
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  [![View on Construct Hub](https://constructs.dev/badge?package=rds-database-running-scheduler)](https://constructs.dev/packages/rds-database-running-scheduler)
9
9
 
10
- This AWS CDK construct controls the start and stop of RDS DB instances and Aurora clusters based on resource tags. EventBridge Scheduler invokes a durable Lambda function on a cron schedule so databases run only during defined working hours. The Lambda discovers tagged resources account-wide via the Resource Groups Tagging API, deduplicates Aurora cluster member instances when the parent cluster is also tagged, and controls each remaining resource using the region encoded in its ARN. Slack notifications are optional via `notification.slack`. Default schedule: start 07:50 UTC, stop 19:05 UTC, Monday–Friday.
10
+ This AWS CDK construct controls the start and stop of RDS DB instances and Aurora clusters based on resource tags. EventBridge Scheduler invokes a durable Lambda function on a cron schedule so databases run only during defined working hours. The Lambda discovers tagged resources account-wide via the Resource Groups Tagging API, deduplicates Aurora cluster member instances when the parent cluster is also tagged, and controls each remaining resource using the region encoded in its ARN. Slack notifications are optional via `notification.slack.enable` (default `false`). Default schedule: start 07:50 UTC, stop 19:05 UTC, Monday–Friday.
11
11
 
12
12
  ## Features
13
13
 
@@ -17,7 +17,7 @@ This AWS CDK construct controls the start and stop of RDS DB instances and Auror
17
17
  - **Region-aware RDS control**: Creates per-region RDS clients from each resource ARN so cross-region resources are handled correctly.
18
18
  - **EventBridge Scheduler**: Cron-based start and stop schedules with configurable timezone, time, and weekdays.
19
19
  - **Lambda with Durable Execution**: A single durable run discovers resources by tag, starts or stops them, and polls until they reach the desired state (with timeout).
20
- - **Optional Slack notifications**: Set `notification.slack` to post schedule progress and per-resource results to Slack via Secrets Manager. Omit `notification` (or `notification.slack`) to skip secret lookup, Slack API calls, and related IAM grants.
20
+ - **Optional Slack notifications**: Set `notification.slack.enable` to `true` and provide `secretName` to post schedule progress and per-resource results to Slack via Secrets Manager. Leave `enable` unset (default `false`), set it to `false`, or omit `notification.slack` to skip secret lookup, Slack API calls, and related IAM grants.
21
21
  - **Supported resources**: RDS DB instances and RDS Aurora clusters.
22
22
 
23
23
  ## Installation
@@ -46,14 +46,14 @@ import { RDSDatabaseRunningScheduler } from 'rds-database-running-scheduler';
46
46
 
47
47
  new RDSDatabaseRunningScheduler(scope, 'RDSDatabaseRunningScheduler', {
48
48
  targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },
49
- notification: { slack: { secretName: 'example/slack/webhook' } },
49
+ notification: { slack: { enable: true, secretName: 'example/slack/webhook' } },
50
50
  enableScheduling: true,
51
51
  startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },
52
52
  stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },
53
53
  });
54
54
  ```
55
55
 
56
- Without Slack notifications, omit `notification` (or omit `notification.slack`):
56
+ Without Slack notifications, omit `notification` (or set `notification.slack.enable` to `false`):
57
57
 
58
58
  ```typescript
59
59
  new RDSDatabaseRunningScheduler(scope, 'RDSDatabaseRunningScheduler', {
@@ -74,7 +74,7 @@ const app = new App();
74
74
 
75
75
  new RDSDatabaseRunningScheduleStack(app, 'RDSDatabaseRunningScheduleStack', {
76
76
  targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },
77
- notification: { slack: { secretName: 'example/slack/webhook' } },
77
+ notification: { slack: { enable: true, secretName: 'example/slack/webhook' } },
78
78
  enableScheduling: true,
79
79
  startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },
80
80
  stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },
@@ -85,7 +85,7 @@ Tag your RDS instances or Aurora clusters with the same `tagKey` and one of the
85
85
 
86
86
  For Aurora, tagging the cluster is sufficient. If member DB instances inherit the same tag, the Lambda automatically excludes them when the parent cluster is also targeted, so cluster-level start/stop is applied once without conflicting instance-level operations.
87
87
 
88
- When `notification.slack` is set, the secret in AWS Secrets Manager must contain JSON with `token` and `channel` fields:
88
+ When Slack is enabled, the secret in AWS Secrets Manager must contain JSON with `token` and `channel` fields:
89
89
 
90
90
  ```json
91
91
  {
@@ -99,7 +99,7 @@ When `notification.slack` is set, the secret in AWS Secrets Manager must contain
99
99
  | Option | Type | Required | Description |
100
100
  |--------|------|----------|-------------|
101
101
  | `targetResource` | `TargetResource` | Yes | Tag key and values used to select RDS resources. |
102
- | `notification` | `Notification` | No | Notification channels. Set `notification.slack` to enable Slack. Omit to disable notifications. |
102
+ | `notification` | `Notification` | No | Notification channels. Set `notification.slack.enable` to `true` to send Slack messages. |
103
103
  | `enableScheduling` | `boolean` | No | Whether start and stop schedules are enabled. Default: `true`. |
104
104
  | `startSchedule` | `Schedule` | No | Start schedule. Default: 07:50 UTC, MON–FRI. |
105
105
  | `stopSchedule` | `Schedule` | No | Stop schedule. Default: 19:05 UTC, MON–FRI. |
@@ -124,20 +124,21 @@ When `notification.slack` is set, the secret in AWS Secrets Manager must contain
124
124
 
125
125
  | Field | Type | Required | Description |
126
126
  |-------|------|----------|-------------|
127
- | `slack` | `SlackNotification` | No | Presence enables Slack notifications. |
127
+ | `slack` | `SlackNotification` | No | Slack settings. Omit, or set `enable` to `false`, to disable Slack. |
128
128
 
129
129
  ### SlackNotification
130
130
 
131
131
  | Field | Type | Required | Description |
132
132
  |-------|------|----------|-------------|
133
- | `secretName` | `string` | Yes | Secrets Manager secret name containing Slack `token` and `channel`. |
133
+ | `enable` | `boolean` | No | Enable Slack notifications. Default: `false`. When `false`, secret lookup, Slack API calls, and IAM grants are skipped. |
134
+ | `secretName` | `string` | No | Secrets Manager secret name containing Slack `token` and `channel`. Required when `enable` is `true`. |
134
135
 
135
136
  ## Requirements
136
137
 
137
138
  - **Node.js**: >= 20.0.0
138
139
  - **AWS CDK**: ^2.232.0
139
140
  - **constructs**: ^10.5.1
140
- - **AWS**: Account and region with permissions to create EventBridge Scheduler, Lambda, IAM, and CloudWatch Logs; RDS describe/start/stop permissions for targeted resources; Resource Groups Tagging API access for resource discovery. Secrets Manager access is required only when `notification.slack` is set.
141
+ - **AWS**: Account and region with permissions to create EventBridge Scheduler, Lambda, IAM, and CloudWatch Logs; RDS describe/start/stop permissions for targeted resources. Start/stop IAM is scoped to DB instance and cluster ARNs in the account and to `aws:ResourceTag` matching `targetResource`. Resource Groups Tagging API access is required for resource discovery. Secrets Manager access is required only when Slack notifications are enabled.
141
142
 
142
143
  ## License
143
144