rds-database-running-scheduler 0.4.4 → 0.5.0

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/API.md CHANGED
@@ -9,9 +9,11 @@ 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 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.
12
+ region encoded in its ARN. Each resource is checked on a configurable interval
13
+ until it reaches a stable state or the per-resource wait limit. When Slack is
14
+ enabled, the Lambda posts progress and results to Slack, and can post a timeout
15
+ message when the wait limit is exceeded. Otherwise Secrets Manager lookup, Slack
16
+ API calls, and related IAM grants are skipped.
15
17
 
16
18
  #### Initializers <a name="Initializers" id="rds-database-running-scheduler.RDSDatabaseRunningScheduler.Initializer"></a>
17
19
 
@@ -157,7 +159,8 @@ The tree node.
157
159
  CDK stack that provisions scheduled start/stop control for tagged RDS resources in the deployment account.
158
160
 
159
161
  Delegates resource discovery, cluster-priority deduplication, start/stop
160
- execution, and optional Slack notifications to {@link RDSDatabaseRunningScheduler}.
162
+ execution, per-resource wait limits, and optional Slack notifications to
163
+ {@link RDSDatabaseRunningScheduler}.
161
164
 
162
165
  #### Initializers <a name="Initializers" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStack.Initializer"></a>
163
166
 
@@ -1147,7 +1150,7 @@ public readonly slack: SlackNotification;
1147
1150
 
1148
1151
  Optional Slack notification settings.
1149
1152
 
1150
- Set `slack.enable` to `true` to send messages.
1153
+ Set `slack.enable` to {@link SlackNotificationEnable.ENABLED} to send messages.
1151
1154
 
1152
1155
  ---
1153
1156
 
@@ -1168,8 +1171,9 @@ const rDSDatabaseRunningSchedulerProps: RDSDatabaseRunningSchedulerProps = { ...
1168
1171
  | **Name** | **Type** | **Description** |
1169
1172
  | --- | --- | --- |
1170
1173
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.targetResource">targetResource</a></code> | <code><a href="#rds-database-running-scheduler.TargetResource">TargetResource</a></code> | Tag filter to select RDS instances and clusters. |
1171
- | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.enableScheduling">enableScheduling</a></code> | <code>boolean</code> | Enables or disables both start and stop schedules. |
1174
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.enableScheduling">enableScheduling</a></code> | <code><a href="#rds-database-running-scheduler.SchedulingEnable">SchedulingEnable</a></code> | Enables or disables both start and stop schedules. |
1172
1175
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.notification">notification</a></code> | <code><a href="#rds-database-running-scheduler.Notification">Notification</a></code> | Optional notification channels. |
1176
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.resourceWait">resourceWait</a></code> | <code><a href="#rds-database-running-scheduler.ResourceWait">ResourceWait</a></code> | Optional per-resource wait settings. |
1173
1177
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.startSchedule">startSchedule</a></code> | <code><a href="#rds-database-running-scheduler.Schedule">Schedule</a></code> | Optional override for start schedule cron configuration. |
1174
1178
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.stopSchedule">stopSchedule</a></code> | <code><a href="#rds-database-running-scheduler.Schedule">Schedule</a></code> | Optional override for stop schedule cron configuration. |
1175
1179
 
@@ -1190,15 +1194,14 @@ Tag filter to select RDS instances and clusters.
1190
1194
  ##### `enableScheduling`<sup>Optional</sup> <a name="enableScheduling" id="rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.enableScheduling"></a>
1191
1195
 
1192
1196
  ```typescript
1193
- public readonly enableScheduling: boolean;
1197
+ public readonly enableScheduling: SchedulingEnable;
1194
1198
  ```
1195
1199
 
1196
- - *Type:* boolean
1200
+ - *Type:* <a href="#rds-database-running-scheduler.SchedulingEnable">SchedulingEnable</a>
1201
+ - *Default:* SchedulingEnable.ENABLED
1197
1202
 
1198
1203
  Enables or disables both start and stop schedules.
1199
1204
 
1200
- Default: `true`.
1201
-
1202
1205
  ---
1203
1206
 
1204
1207
  ##### `notification`<sup>Optional</sup> <a name="notification" id="rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.notification"></a>
@@ -1211,7 +1214,22 @@ public readonly notification: Notification;
1211
1214
 
1212
1215
  Optional notification channels.
1213
1216
 
1214
- Set `notification.slack.enable` to `true` and provide `secretName` to send Slack messages.
1217
+ Set `notification.slack.enable` to {@link SlackNotificationEnable.ENABLED}
1218
+ and provide `secretName` to send Slack messages.
1219
+
1220
+ ---
1221
+
1222
+ ##### `resourceWait`<sup>Optional</sup> <a name="resourceWait" id="rds-database-running-scheduler.RDSDatabaseRunningSchedulerProps.property.resourceWait"></a>
1223
+
1224
+ ```typescript
1225
+ public readonly resourceWait: ResourceWait;
1226
+ ```
1227
+
1228
+ - *Type:* <a href="#rds-database-running-scheduler.ResourceWait">ResourceWait</a>
1229
+
1230
+ Optional per-resource wait settings.
1231
+
1232
+ Defaults to a 60-second interval and a 1800-second maximum.
1215
1233
 
1216
1234
  ---
1217
1235
 
@@ -1243,6 +1261,9 @@ Optional override for stop schedule cron configuration.
1243
1261
 
1244
1262
  Properties for the RDS database running schedule stack.
1245
1263
 
1264
+ Scheduler fields match {@link RDSDatabaseRunningSchedulerProps}.
1265
+ The remaining fields are the standard stack settings from `StackProps`, such as `env`.
1266
+
1246
1267
  #### Initializer <a name="Initializer" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.Initializer"></a>
1247
1268
 
1248
1269
  ```typescript
@@ -1255,6 +1276,12 @@ const rDSDatabaseRunningScheduleStackProps: RDSDatabaseRunningScheduleStackProps
1255
1276
 
1256
1277
  | **Name** | **Type** | **Description** |
1257
1278
  | --- | --- | --- |
1279
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.targetResource">targetResource</a></code> | <code><a href="#rds-database-running-scheduler.TargetResource">TargetResource</a></code> | Tag filter to select RDS instances and clusters. |
1280
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.enableScheduling">enableScheduling</a></code> | <code><a href="#rds-database-running-scheduler.SchedulingEnable">SchedulingEnable</a></code> | Enables or disables both start and stop schedules. |
1281
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.notification">notification</a></code> | <code><a href="#rds-database-running-scheduler.Notification">Notification</a></code> | Optional notification channels. |
1282
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.resourceWait">resourceWait</a></code> | <code><a href="#rds-database-running-scheduler.ResourceWait">ResourceWait</a></code> | Optional per-resource wait settings. |
1283
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.startSchedule">startSchedule</a></code> | <code><a href="#rds-database-running-scheduler.Schedule">Schedule</a></code> | Optional override for start schedule cron configuration. |
1284
+ | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.stopSchedule">stopSchedule</a></code> | <code><a href="#rds-database-running-scheduler.Schedule">Schedule</a></code> | Optional override for stop schedule cron configuration. |
1258
1285
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.analyticsReporting">analyticsReporting</a></code> | <code>boolean</code> | Include runtime versioning information in this Stack. |
1259
1286
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.crossRegionReferences">crossRegionReferences</a></code> | <code>boolean</code> | Enable this flag to allow native cross region stack references. |
1260
1287
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.description">description</a></code> | <code>string</code> | A description of the stack. |
@@ -1267,11 +1294,84 @@ const rDSDatabaseRunningScheduleStackProps: RDSDatabaseRunningScheduleStackProps
1267
1294
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.synthesizer">synthesizer</a></code> | <code>aws-cdk-lib.IStackSynthesizer</code> | Synthesis method to use while deploying this stack. |
1268
1295
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.tags">tags</a></code> | <code>{[ key: string ]: string}</code> | Tags that will be applied to the Stack. |
1269
1296
  | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.terminationProtection">terminationProtection</a></code> | <code>boolean</code> | Whether to enable termination protection for this stack. |
1270
- | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.targetResource">targetResource</a></code> | <code><a href="#rds-database-running-scheduler.TargetResource">TargetResource</a></code> | Tag filter used to select target RDS resources. |
1271
- | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.enableScheduling">enableScheduling</a></code> | <code>boolean</code> | Enables or disables both start and stop schedules. |
1272
- | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.notification">notification</a></code> | <code><a href="#rds-database-running-scheduler.Notification">Notification</a></code> | Optional notification channels. |
1273
- | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.startSchedule">startSchedule</a></code> | <code><a href="#rds-database-running-scheduler.Schedule">Schedule</a></code> | Optional cron configuration for start operations. |
1274
- | <code><a href="#rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.stopSchedule">stopSchedule</a></code> | <code><a href="#rds-database-running-scheduler.Schedule">Schedule</a></code> | Optional cron configuration for stop operations. |
1297
+
1298
+ ---
1299
+
1300
+ ##### `targetResource`<sup>Required</sup> <a name="targetResource" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.targetResource"></a>
1301
+
1302
+ ```typescript
1303
+ public readonly targetResource: TargetResource;
1304
+ ```
1305
+
1306
+ - *Type:* <a href="#rds-database-running-scheduler.TargetResource">TargetResource</a>
1307
+
1308
+ Tag filter to select RDS instances and clusters.
1309
+
1310
+ ---
1311
+
1312
+ ##### `enableScheduling`<sup>Optional</sup> <a name="enableScheduling" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.enableScheduling"></a>
1313
+
1314
+ ```typescript
1315
+ public readonly enableScheduling: SchedulingEnable;
1316
+ ```
1317
+
1318
+ - *Type:* <a href="#rds-database-running-scheduler.SchedulingEnable">SchedulingEnable</a>
1319
+ - *Default:* SchedulingEnable.ENABLED
1320
+
1321
+ Enables or disables both start and stop schedules.
1322
+
1323
+ ---
1324
+
1325
+ ##### `notification`<sup>Optional</sup> <a name="notification" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.notification"></a>
1326
+
1327
+ ```typescript
1328
+ public readonly notification: Notification;
1329
+ ```
1330
+
1331
+ - *Type:* <a href="#rds-database-running-scheduler.Notification">Notification</a>
1332
+
1333
+ Optional notification channels.
1334
+
1335
+ Set `notification.slack.enable` to {@link SlackNotificationEnable.ENABLED}
1336
+ and provide `secretName` to send Slack messages.
1337
+
1338
+ ---
1339
+
1340
+ ##### `resourceWait`<sup>Optional</sup> <a name="resourceWait" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.resourceWait"></a>
1341
+
1342
+ ```typescript
1343
+ public readonly resourceWait: ResourceWait;
1344
+ ```
1345
+
1346
+ - *Type:* <a href="#rds-database-running-scheduler.ResourceWait">ResourceWait</a>
1347
+
1348
+ Optional per-resource wait settings.
1349
+
1350
+ Defaults to a 60-second interval and a 1800-second maximum.
1351
+
1352
+ ---
1353
+
1354
+ ##### `startSchedule`<sup>Optional</sup> <a name="startSchedule" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.startSchedule"></a>
1355
+
1356
+ ```typescript
1357
+ public readonly startSchedule: Schedule;
1358
+ ```
1359
+
1360
+ - *Type:* <a href="#rds-database-running-scheduler.Schedule">Schedule</a>
1361
+
1362
+ Optional override for start schedule cron configuration.
1363
+
1364
+ ---
1365
+
1366
+ ##### `stopSchedule`<sup>Optional</sup> <a name="stopSchedule" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.stopSchedule"></a>
1367
+
1368
+ ```typescript
1369
+ public readonly stopSchedule: Schedule;
1370
+ ```
1371
+
1372
+ - *Type:* <a href="#rds-database-running-scheduler.Schedule">Schedule</a>
1373
+
1374
+ Optional override for stop schedule cron configuration.
1275
1375
 
1276
1376
  ---
1277
1377
 
@@ -1519,67 +1619,55 @@ Whether to enable termination protection for this stack.
1519
1619
 
1520
1620
  ---
1521
1621
 
1522
- ##### `targetResource`<sup>Required</sup> <a name="targetResource" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.targetResource"></a>
1622
+ ### ResourceWait <a name="ResourceWait" id="rds-database-running-scheduler.ResourceWait"></a>
1523
1623
 
1524
- ```typescript
1525
- public readonly targetResource: TargetResource;
1526
- ```
1527
-
1528
- - *Type:* <a href="#rds-database-running-scheduler.TargetResource">TargetResource</a>
1529
-
1530
- Tag filter used to select target RDS resources.
1531
-
1532
- ---
1624
+ Per-resource wait settings for start/stop status checks.
1533
1625
 
1534
- ##### `enableScheduling`<sup>Optional</sup> <a name="enableScheduling" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.enableScheduling"></a>
1626
+ #### Initializer <a name="Initializer" id="rds-database-running-scheduler.ResourceWait.Initializer"></a>
1535
1627
 
1536
1628
  ```typescript
1537
- public readonly enableScheduling: boolean;
1538
- ```
1629
+ import { ResourceWait } from 'rds-database-running-scheduler'
1539
1630
 
1540
- - *Type:* boolean
1631
+ const resourceWait: ResourceWait = { ... }
1632
+ ```
1541
1633
 
1542
- Enables or disables both start and stop schedules.
1634
+ #### Properties <a name="Properties" id="Properties"></a>
1543
1635
 
1544
- Default: `true`.
1636
+ | **Name** | **Type** | **Description** |
1637
+ | --- | --- | --- |
1638
+ | <code><a href="#rds-database-running-scheduler.ResourceWait.property.intervalSeconds">intervalSeconds</a></code> | <code>number</code> | Seconds between status checks while a resource is starting, stopping, or otherwise transitioning. |
1639
+ | <code><a href="#rds-database-running-scheduler.ResourceWait.property.maxSeconds">maxSeconds</a></code> | <code>number</code> | Maximum accumulated wait seconds for one resource to reach a stable state. |
1545
1640
 
1546
1641
  ---
1547
1642
 
1548
- ##### `notification`<sup>Optional</sup> <a name="notification" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.notification"></a>
1643
+ ##### `intervalSeconds`<sup>Optional</sup> <a name="intervalSeconds" id="rds-database-running-scheduler.ResourceWait.property.intervalSeconds"></a>
1549
1644
 
1550
1645
  ```typescript
1551
- public readonly notification: Notification;
1646
+ public readonly intervalSeconds: number;
1552
1647
  ```
1553
1648
 
1554
- - *Type:* <a href="#rds-database-running-scheduler.Notification">Notification</a>
1649
+ - *Type:* number
1650
+ - *Default:* 60
1555
1651
 
1556
- Optional notification channels.
1652
+ Seconds between status checks while a resource is starting, stopping, or otherwise transitioning.
1557
1653
 
1558
- Set `notification.slack.enable` to `true` and provide `secretName` to send Slack messages.
1654
+ Must be a positive integer.
1559
1655
 
1560
1656
  ---
1561
1657
 
1562
- ##### `startSchedule`<sup>Optional</sup> <a name="startSchedule" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.startSchedule"></a>
1658
+ ##### `maxSeconds`<sup>Optional</sup> <a name="maxSeconds" id="rds-database-running-scheduler.ResourceWait.property.maxSeconds"></a>
1563
1659
 
1564
1660
  ```typescript
1565
- public readonly startSchedule: Schedule;
1661
+ public readonly maxSeconds: number;
1566
1662
  ```
1567
1663
 
1568
- - *Type:* <a href="#rds-database-running-scheduler.Schedule">Schedule</a>
1569
-
1570
- Optional cron configuration for start operations.
1571
-
1572
- ---
1573
-
1574
- ##### `stopSchedule`<sup>Optional</sup> <a name="stopSchedule" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStackProps.property.stopSchedule"></a>
1575
-
1576
- ```typescript
1577
- public readonly stopSchedule: Schedule;
1578
- ```
1664
+ - *Type:* number
1665
+ - *Default:* 1800
1579
1666
 
1580
- - *Type:* <a href="#rds-database-running-scheduler.Schedule">Schedule</a>
1667
+ Maximum accumulated wait seconds for one resource to reach a stable state.
1581
1668
 
1582
- Optional cron configuration for stop operations.
1669
+ Must be a positive integer, greater than or equal to `intervalSeconds`, and at most 6900
1670
+ so the limit fires before the 2-hour durable execution timeout.
1583
1671
 
1584
1672
  ---
1585
1673
 
@@ -1658,7 +1746,7 @@ Weekday field in cron expression.
1658
1746
 
1659
1747
  Slack notification settings.
1660
1748
 
1661
- Notifications are off unless `enable` is `true`.
1749
+ Notifications are off unless `enable` is {@link SlackNotificationEnable.ENABLED}.
1662
1750
 
1663
1751
  #### Initializer <a name="Initializer" id="rds-database-running-scheduler.SlackNotification.Initializer"></a>
1664
1752
 
@@ -1672,7 +1760,8 @@ const slackNotification: SlackNotification = { ... }
1672
1760
 
1673
1761
  | **Name** | **Type** | **Description** |
1674
1762
  | --- | --- | --- |
1675
- | <code><a href="#rds-database-running-scheduler.SlackNotification.property.enable">enable</a></code> | <code>boolean</code> | Whether Slack notifications are enabled. |
1763
+ | <code><a href="#rds-database-running-scheduler.SlackNotification.property.enable">enable</a></code> | <code><a href="#rds-database-running-scheduler.SlackNotificationEnable">SlackNotificationEnable</a></code> | Whether Slack notifications are enabled. |
1764
+ | <code><a href="#rds-database-running-scheduler.SlackNotification.property.notifyOnWaitTimeout">notifyOnWaitTimeout</a></code> | <code><a href="#rds-database-running-scheduler.WaitTimeoutNotification">WaitTimeoutNotification</a></code> | Whether to post a Slack message when a resource exceeds `resourceWait.maxSeconds`. Applies only when `enable` is {@link SlackNotificationEnable.ENABLED}. |
1676
1765
  | <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`). |
1677
1766
 
1678
1767
  ---
@@ -1680,15 +1769,29 @@ const slackNotification: SlackNotification = { ... }
1680
1769
  ##### `enable`<sup>Optional</sup> <a name="enable" id="rds-database-running-scheduler.SlackNotification.property.enable"></a>
1681
1770
 
1682
1771
  ```typescript
1683
- public readonly enable: boolean;
1772
+ public readonly enable: SlackNotificationEnable;
1684
1773
  ```
1685
1774
 
1686
- - *Type:* boolean
1687
- - *Default:* false
1775
+ - *Type:* <a href="#rds-database-running-scheduler.SlackNotificationEnable">SlackNotificationEnable</a>
1776
+ - *Default:* SlackNotificationEnable.DISABLED
1688
1777
 
1689
1778
  Whether Slack notifications are enabled.
1690
1779
 
1691
- When `false`, Secrets Manager lookup, Slack API calls, and related IAM grants are skipped.
1780
+ When {@link SlackNotificationEnable.DISABLED}, Secrets Manager lookup,
1781
+ Slack API calls, and related IAM grants are skipped.
1782
+
1783
+ ---
1784
+
1785
+ ##### `notifyOnWaitTimeout`<sup>Optional</sup> <a name="notifyOnWaitTimeout" id="rds-database-running-scheduler.SlackNotification.property.notifyOnWaitTimeout"></a>
1786
+
1787
+ ```typescript
1788
+ public readonly notifyOnWaitTimeout: WaitTimeoutNotification;
1789
+ ```
1790
+
1791
+ - *Type:* <a href="#rds-database-running-scheduler.WaitTimeoutNotification">WaitTimeoutNotification</a>
1792
+ - *Default:* WaitTimeoutNotification.ENABLED
1793
+
1794
+ Whether to post a Slack message when a resource exceeds `resourceWait.maxSeconds`. Applies only when `enable` is {@link SlackNotificationEnable.ENABLED}.
1692
1795
 
1693
1796
  ---
1694
1797
 
@@ -1702,7 +1805,7 @@ public readonly secretName: string;
1702
1805
 
1703
1806
  Name of the Slack API secret in AWS Secrets Manager (`token` and `channel`).
1704
1807
 
1705
- Required when `enable` is `true`.
1808
+ Required when `enable` is {@link SlackNotificationEnable.ENABLED}.
1706
1809
 
1707
1810
  ---
1708
1811
 
@@ -1753,3 +1856,85 @@ Tag values matched by the scheduler target query.
1753
1856
 
1754
1857
 
1755
1858
 
1859
+ ## Enums <a name="Enums" id="Enums"></a>
1860
+
1861
+ ### SchedulingEnable <a name="SchedulingEnable" id="rds-database-running-scheduler.SchedulingEnable"></a>
1862
+
1863
+ Whether the start and stop schedules are active.
1864
+
1865
+ #### Members <a name="Members" id="Members"></a>
1866
+
1867
+ | **Name** | **Description** |
1868
+ | --- | --- |
1869
+ | <code><a href="#rds-database-running-scheduler.SchedulingEnable.ENABLED">ENABLED</a></code> | Create the schedules in the enabled state. |
1870
+ | <code><a href="#rds-database-running-scheduler.SchedulingEnable.DISABLED">DISABLED</a></code> | Create the schedules in the disabled state. |
1871
+
1872
+ ---
1873
+
1874
+ ##### `ENABLED` <a name="ENABLED" id="rds-database-running-scheduler.SchedulingEnable.ENABLED"></a>
1875
+
1876
+ Create the schedules in the enabled state.
1877
+
1878
+ ---
1879
+
1880
+
1881
+ ##### `DISABLED` <a name="DISABLED" id="rds-database-running-scheduler.SchedulingEnable.DISABLED"></a>
1882
+
1883
+ Create the schedules in the disabled state.
1884
+
1885
+ ---
1886
+
1887
+
1888
+ ### SlackNotificationEnable <a name="SlackNotificationEnable" id="rds-database-running-scheduler.SlackNotificationEnable"></a>
1889
+
1890
+ Whether Slack notifications are sent.
1891
+
1892
+ #### Members <a name="Members" id="Members"></a>
1893
+
1894
+ | **Name** | **Description** |
1895
+ | --- | --- |
1896
+ | <code><a href="#rds-database-running-scheduler.SlackNotificationEnable.ENABLED">ENABLED</a></code> | Send Slack messages. |
1897
+ | <code><a href="#rds-database-running-scheduler.SlackNotificationEnable.DISABLED">DISABLED</a></code> | Skip secret lookup, Slack API calls, and related IAM grants. |
1898
+
1899
+ ---
1900
+
1901
+ ##### `ENABLED` <a name="ENABLED" id="rds-database-running-scheduler.SlackNotificationEnable.ENABLED"></a>
1902
+
1903
+ Send Slack messages.
1904
+
1905
+ ---
1906
+
1907
+
1908
+ ##### `DISABLED` <a name="DISABLED" id="rds-database-running-scheduler.SlackNotificationEnable.DISABLED"></a>
1909
+
1910
+ Skip secret lookup, Slack API calls, and related IAM grants.
1911
+
1912
+ ---
1913
+
1914
+
1915
+ ### WaitTimeoutNotification <a name="WaitTimeoutNotification" id="rds-database-running-scheduler.WaitTimeoutNotification"></a>
1916
+
1917
+ Whether to post a Slack message when a resource exceeds its wait limit.
1918
+
1919
+ #### Members <a name="Members" id="Members"></a>
1920
+
1921
+ | **Name** | **Description** |
1922
+ | --- | --- |
1923
+ | <code><a href="#rds-database-running-scheduler.WaitTimeoutNotification.ENABLED">ENABLED</a></code> | Post a Slack message when the per-resource wait limit is exceeded. |
1924
+ | <code><a href="#rds-database-running-scheduler.WaitTimeoutNotification.DISABLED">DISABLED</a></code> | Do not post a Slack message when the per-resource wait limit is exceeded. |
1925
+
1926
+ ---
1927
+
1928
+ ##### `ENABLED` <a name="ENABLED" id="rds-database-running-scheduler.WaitTimeoutNotification.ENABLED"></a>
1929
+
1930
+ Post a Slack message when the per-resource wait limit is exceeded.
1931
+
1932
+ ---
1933
+
1934
+
1935
+ ##### `DISABLED` <a name="DISABLED" id="rds-database-running-scheduler.WaitTimeoutNotification.DISABLED"></a>
1936
+
1937
+ Do not post a Slack message when the per-resource wait limit is exceeded.
1938
+
1939
+ ---
1940
+
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # RDS Database Running Scheduler (AWS CDK v2)
1
+ # RDS Database Running Scheduler (CDK v2)
2
2
 
3
- [![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)
4
3
  [![npm version](https://img.shields.io/npm/v/rds-database-running-scheduler?style=flat-square)](https://www.npmjs.com/package/rds-database-running-scheduler)
5
- [![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)
6
- [![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)
4
+ [![license](https://img.shields.io/npm/l/rds-database-running-scheduler?style=flat-square)](https://www.npmjs.com/package/rds-database-running-scheduler)
5
+ [![Node.js](https://img.shields.io/node/v/rds-database-running-scheduler?style=flat-square)](https://www.npmjs.com/package/rds-database-running-scheduler)
6
+ [![build](https://img.shields.io/github/actions/workflow/status/gammarers-aws-cdk-constructs/rds-database-running-scheduler/build.yml?label=build&style=flat-square)](https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler/actions/workflows/build.yml)
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.enable` (default `false`). 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.
11
11
 
12
12
  ## Features
13
13
 
@@ -16,66 +16,80 @@ This AWS CDK construct controls the start and stop of RDS DB instances and Auror
16
16
  - **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.
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
- - **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.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.
19
+ - **Lambda with Durable Execution**: A single durable run discovers resources by tag, starts or stops them, and waits until they reach the desired state or the per-resource wait limit.
20
+ - **Configurable wait**: Set `resourceWait.intervalSeconds` and `resourceWait.maxSeconds` to control how often each resource is checked and how long the function waits before timing out. Defaults are 60 seconds and 1800 seconds.
21
+ - **Optional Slack notifications**: Set `notification.slack.enable` to `SlackNotificationEnable.ENABLED` and provide `secretName` to post schedule progress and per-resource results to Slack via Secrets Manager. Leave `enable` unset (default `SlackNotificationEnable.DISABLED`), set it to `DISABLED`, or omit `notification.slack` to skip secret lookup, Slack API calls, and related IAM grants. When Slack is enabled, a timeout posts a message unless `notification.slack.notifyOnWaitTimeout` is `WaitTimeoutNotification.DISABLED`.
21
22
  - **Supported resources**: RDS DB instances and RDS Aurora clusters.
22
23
 
24
+ ## How it works
25
+
26
+ EventBridge Scheduler runs a start cron and a stop cron. Each one invokes a durable Lambda function.
27
+
28
+ The function searches the deployment account for RDS DB instances and Aurora clusters that match `targetResource`. When both a cluster and its member instances match, only the cluster is controlled. Each remaining resource is started or stopped in the region taken from its ARN.
29
+
30
+ The function then checks that resource every `resourceWait.intervalSeconds` until it is available or stopped, or until `resourceWait.maxSeconds` elapses. When Slack is enabled, it posts progress and, by default, a message when the wait limit is exceeded.
31
+
23
32
  ## Installation
24
33
 
25
- **npm**
34
+ ### npm
26
35
 
27
36
  ```bash
28
37
  npm install rds-database-running-scheduler
29
38
  ```
30
39
 
31
- **yarn**
40
+ ### yarn
32
41
 
33
42
  ```bash
34
43
  yarn add rds-database-running-scheduler
35
44
  ```
36
45
 
46
+ ### pnpm
47
+
48
+ ```bash
49
+ pnpm add rds-database-running-scheduler
50
+ ```
51
+
37
52
  ## Usage
38
53
 
39
54
  Use the **Construct** `RDSDatabaseRunningScheduler` when adding the scheduler into an existing Stack or any CDK scope.
40
55
 
41
- With Slack notifications:
42
-
43
56
  ```typescript
44
- import { TimeZone } from 'aws-cdk-lib';
45
57
  import { RDSDatabaseRunningScheduler } from 'rds-database-running-scheduler';
46
58
 
47
59
  new RDSDatabaseRunningScheduler(scope, 'RDSDatabaseRunningScheduler', {
48
60
  targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },
49
- notification: { slack: { enable: true, secretName: 'example/slack/webhook' } },
50
- enableScheduling: true,
51
- startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },
52
- stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },
53
61
  });
54
62
  ```
55
63
 
56
- Without Slack notifications, omit `notification` (or set `notification.slack.enable` to `false`):
64
+ This uses the default schedules: start at 07:50 UTC and stop at 19:05 UTC, Monday–Friday. Slack notifications are off.
65
+
66
+ With Slack notifications and a custom schedule:
57
67
 
58
68
  ```typescript
69
+ import { TimeZone } from 'aws-cdk-lib';
70
+ import { RDSDatabaseRunningScheduler, SchedulingEnable, SlackNotificationEnable } from 'rds-database-running-scheduler';
71
+
59
72
  new RDSDatabaseRunningScheduler(scope, 'RDSDatabaseRunningScheduler', {
60
73
  targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },
61
- enableScheduling: true,
74
+ notification: { slack: { enable: SlackNotificationEnable.ENABLED, secretName: 'example/slack/webhook' } },
75
+ enableScheduling: SchedulingEnable.ENABLED,
62
76
  startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },
63
77
  stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },
64
78
  });
65
79
  ```
66
80
 
67
- Use the **Stack** `RDSDatabaseRunningScheduleStack` when you want a dedicated Stack that only contains the scheduler. Both accept the same props.
81
+ Use the **Stack** `RDSDatabaseRunningScheduleStack` when you want a dedicated Stack that only contains the scheduler. Both accept the same scheduler props.
68
82
 
69
83
  ```typescript
70
84
  import { App, TimeZone } from 'aws-cdk-lib';
71
- import { RDSDatabaseRunningScheduleStack } from 'rds-database-running-scheduler';
85
+ import { RDSDatabaseRunningScheduleStack, SchedulingEnable, SlackNotificationEnable } from 'rds-database-running-scheduler';
72
86
 
73
87
  const app = new App();
74
88
 
75
89
  new RDSDatabaseRunningScheduleStack(app, 'RDSDatabaseRunningScheduleStack', {
76
90
  targetResource: { tagKey: 'WorkHoursRunning', tagValues: ['YES'] },
77
- notification: { slack: { enable: true, secretName: 'example/slack/webhook' } },
78
- enableScheduling: true,
91
+ notification: { slack: { enable: SlackNotificationEnable.ENABLED, secretName: 'example/slack/webhook' } },
92
+ enableScheduling: SchedulingEnable.ENABLED,
79
93
  startSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '50', hour: '7', week: 'MON-FRI' },
80
94
  stopSchedule: { timezone: TimeZone.ASIA_TOKYO, minute: '5', hour: '19', week: 'MON-FRI' },
81
95
  });
@@ -99,8 +113,9 @@ When Slack is enabled, the secret in AWS Secrets Manager must contain JSON with
99
113
  | Option | Type | Required | Description |
100
114
  |--------|------|----------|-------------|
101
115
  | `targetResource` | `TargetResource` | Yes | Tag key and values used to select RDS resources. |
102
- | `notification` | `Notification` | No | Notification channels. Set `notification.slack.enable` to `true` to send Slack messages. |
103
- | `enableScheduling` | `boolean` | No | Whether start and stop schedules are enabled. Default: `true`. |
116
+ | `notification` | `Notification` | No | Notification channels. Set `notification.slack.enable` to `SlackNotificationEnable.ENABLED` to send Slack messages. |
117
+ | `resourceWait` | `ResourceWait` | No | Per-resource status-check interval and maximum wait. Default: 60-second interval, 1800-second maximum. |
118
+ | `enableScheduling` | `SchedulingEnable` | No | Whether start and stop schedules are enabled. `ENABLED` or `DISABLED`. Default: `ENABLED`. |
104
119
  | `startSchedule` | `Schedule` | No | Start schedule. Default: 07:50 UTC, MON–FRI. |
105
120
  | `stopSchedule` | `Schedule` | No | Stop schedule. Default: 19:05 UTC, MON–FRI. |
106
121
 
@@ -124,14 +139,26 @@ When Slack is enabled, the secret in AWS Secrets Manager must contain JSON with
124
139
 
125
140
  | Field | Type | Required | Description |
126
141
  |-------|------|----------|-------------|
127
- | `slack` | `SlackNotification` | No | Slack settings. Omit, or set `enable` to `false`, to disable Slack. |
142
+ | `slack` | `SlackNotification` | No | Slack settings. Omit, or set `enable` to `SlackNotificationEnable.DISABLED`, to disable Slack. |
128
143
 
129
144
  ### SlackNotification
130
145
 
131
146
  | Field | Type | Required | Description |
132
147
  |-------|------|----------|-------------|
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`. |
148
+ | `enable` | `SlackNotificationEnable` | No | Enable Slack notifications. `ENABLED` or `DISABLED`. Default: `DISABLED`. When `DISABLED`, secret lookup, Slack API calls, and IAM grants are skipped. |
149
+ | `secretName` | `string` | No | Secrets Manager secret name containing Slack `token` and `channel`. Required when `enable` is `ENABLED`. |
150
+ | `notifyOnWaitTimeout` | `WaitTimeoutNotification` | No | Post a Slack message when a resource exceeds `resourceWait.maxSeconds`. `ENABLED` or `DISABLED`. Applies only when `enable` is `ENABLED`. Default: `ENABLED`. |
151
+
152
+ ### ResourceWait
153
+
154
+ | Field | Type | Required | Description |
155
+ |-------|------|----------|-------------|
156
+ | `intervalSeconds` | `number` | No | Seconds between status checks. Positive integer. Default: `60`. |
157
+ | `maxSeconds` | `number` | No | Maximum accumulated wait seconds for one resource. Positive integer, greater than or equal to `intervalSeconds`, and at most `6900`. Default: `1800`. |
158
+
159
+ ## API
160
+
161
+ See [API.md](./API.md).
135
162
 
136
163
  ## Requirements
137
164