@gammarers/aws-rds-database-running-schedule-stack
Advanced tools
Comparing version 1.2.2 to 2.0.0
129
API.md
@@ -867,3 +867,3 @@ # API Reference <a name="API Reference" id="api-reference"></a> | ||
##### `terminationProtection`<sup>Optional</sup> <a name="terminationProtection" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStack.property.terminationProtection"></a> | ||
##### `terminationProtection`<sup>Required</sup> <a name="terminationProtection" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStack.property.terminationProtection"></a> | ||
@@ -903,6 +903,10 @@ ```typescript | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.stackName">stackName</a></code> | <code>string</code> | Name to deploy the stack with. | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.suppressTemplateIndentation">suppressTemplateIndentation</a></code> | <code>boolean</code> | Enable this flag to suppress indentation in generated CloudFormation templates. | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.synthesizer">synthesizer</a></code> | <code>aws-cdk-lib.IStackSynthesizer</code> | Synthesis method to use while deploying this stack. | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.tags">tags</a></code> | <code>{[ key: string ]: string}</code> | Stack tags that will be applied to all the taggable resources and the stack itself. | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.terminationProtection">terminationProtection</a></code> | <code>boolean</code> | Whether to enable termination protection for this stack. | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.targets">targets</a></code> | <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetProperty">TargetProperty</a>[]</code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.targetResource">targetResource</a></code> | <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty">TargetResourceProperty</a></code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.enableScheduling">enableScheduling</a></code> | <code>boolean</code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.startSchedule">startSchedule</a></code> | <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty">ScheduleProperty</a></code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.stopSchedule">stopSchedule</a></code> | <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty">ScheduleProperty</a></code> | *No description.* | | ||
@@ -1055,2 +1059,19 @@ --- | ||
##### `suppressTemplateIndentation`<sup>Optional</sup> <a name="suppressTemplateIndentation" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.suppressTemplateIndentation"></a> | ||
```typescript | ||
public readonly suppressTemplateIndentation: boolean; | ||
``` | ||
- *Type:* boolean | ||
- *Default:* the value of `@aws-cdk/core:suppressTemplateIndentation`, or `false` if that is not set. | ||
Enable this flag to suppress indentation in generated CloudFormation templates. | ||
If not specified, the value of the `@aws-cdk/core:suppressTemplateIndentation` | ||
context key will be used. If that is not specified, then the | ||
default value `false` will be used. | ||
--- | ||
##### `synthesizer`<sup>Optional</sup> <a name="synthesizer" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.synthesizer"></a> | ||
@@ -1105,12 +1126,42 @@ | ||
##### `targets`<sup>Required</sup> <a name="targets" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.targets"></a> | ||
##### `targetResource`<sup>Required</sup> <a name="targetResource" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.targetResource"></a> | ||
```typescript | ||
public readonly targets: TargetProperty[]; | ||
public readonly targetResource: TargetResourceProperty; | ||
``` | ||
- *Type:* <a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetProperty">TargetProperty</a>[] | ||
- *Type:* <a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty">TargetResourceProperty</a> | ||
--- | ||
##### `enableScheduling`<sup>Optional</sup> <a name="enableScheduling" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.enableScheduling"></a> | ||
```typescript | ||
public readonly enableScheduling: boolean; | ||
``` | ||
- *Type:* boolean | ||
--- | ||
##### `startSchedule`<sup>Optional</sup> <a name="startSchedule" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.startSchedule"></a> | ||
```typescript | ||
public readonly startSchedule: ScheduleProperty; | ||
``` | ||
- *Type:* <a href="#@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty">ScheduleProperty</a> | ||
--- | ||
##### `stopSchedule`<sup>Optional</sup> <a name="stopSchedule" id="@gammarers/aws-rds-database-running-schedule-stack.RdsDatabaseRunningScheduleStackProps.property.stopSchedule"></a> | ||
```typescript | ||
public readonly stopSchedule: ScheduleProperty; | ||
``` | ||
- *Type:* <a href="#@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty">ScheduleProperty</a> | ||
--- | ||
### ScheduleProperty <a name="ScheduleProperty" id="@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty"></a> | ||
@@ -1177,10 +1228,10 @@ | ||
### TargetProperty <a name="TargetProperty" id="@gammarers/aws-rds-database-running-schedule-stack.TargetProperty"></a> | ||
### TargetResourceProperty <a name="TargetResourceProperty" id="@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty"></a> | ||
#### Initializer <a name="Initializer" id="@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.Initializer"></a> | ||
#### Initializer <a name="Initializer" id="@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty.Initializer"></a> | ||
```typescript | ||
import { TargetProperty } from '@gammarers/aws-rds-database-running-schedule-stack' | ||
import { TargetResourceProperty } from '@gammarers/aws-rds-database-running-schedule-stack' | ||
const targetProperty: TargetProperty = { ... } | ||
const targetResourceProperty: TargetResourceProperty = { ... } | ||
``` | ||
@@ -1192,72 +1243,28 @@ | ||
| --- | --- | --- | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.property.identifiers">identifiers</a></code> | <code>string[]</code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.property.startSchedule">startSchedule</a></code> | <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty">ScheduleProperty</a></code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.property.stopSchedule">stopSchedule</a></code> | <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty">ScheduleProperty</a></code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.property.type">type</a></code> | <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.DatabaseType">DatabaseType</a></code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty.property.tagKey">tagKey</a></code> | <code>string</code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty.property.tagValues">tagValues</a></code> | <code>string[]</code> | *No description.* | | ||
--- | ||
##### `identifiers`<sup>Required</sup> <a name="identifiers" id="@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.property.identifiers"></a> | ||
##### `tagKey`<sup>Required</sup> <a name="tagKey" id="@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty.property.tagKey"></a> | ||
```typescript | ||
public readonly identifiers: string[]; | ||
public readonly tagKey: string; | ||
``` | ||
- *Type:* string[] | ||
- *Type:* string | ||
--- | ||
##### `startSchedule`<sup>Required</sup> <a name="startSchedule" id="@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.property.startSchedule"></a> | ||
##### `tagValues`<sup>Required</sup> <a name="tagValues" id="@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty.property.tagValues"></a> | ||
```typescript | ||
public readonly startSchedule: ScheduleProperty; | ||
public readonly tagValues: string[]; | ||
``` | ||
- *Type:* <a href="#@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty">ScheduleProperty</a> | ||
- *Type:* string[] | ||
--- | ||
##### `stopSchedule`<sup>Required</sup> <a name="stopSchedule" id="@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.property.stopSchedule"></a> | ||
```typescript | ||
public readonly stopSchedule: ScheduleProperty; | ||
``` | ||
- *Type:* <a href="#@gammarers/aws-rds-database-running-schedule-stack.ScheduleProperty">ScheduleProperty</a> | ||
--- | ||
##### `type`<sup>Required</sup> <a name="type" id="@gammarers/aws-rds-database-running-schedule-stack.TargetProperty.property.type"></a> | ||
```typescript | ||
public readonly type: DatabaseType; | ||
``` | ||
- *Type:* <a href="#@gammarers/aws-rds-database-running-schedule-stack.DatabaseType">DatabaseType</a> | ||
--- | ||
## Enums <a name="Enums" id="Enums"></a> | ||
### DatabaseType <a name="DatabaseType" id="@gammarers/aws-rds-database-running-schedule-stack.DatabaseType"></a> | ||
#### Members <a name="Members" id="Members"></a> | ||
| **Name** | **Description** | | ||
| --- | --- | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.DatabaseType.CLUSTER">CLUSTER</a></code> | *No description.* | | ||
| <code><a href="#@gammarers/aws-rds-database-running-schedule-stack.DatabaseType.INSTANCE">INSTANCE</a></code> | *No description.* | | ||
--- | ||
##### `CLUSTER` <a name="CLUSTER" id="@gammarers/aws-rds-database-running-schedule-stack.DatabaseType.CLUSTER"></a> | ||
--- | ||
##### `INSTANCE` <a name="INSTANCE" id="@gammarers/aws-rds-database-running-schedule-stack.DatabaseType.INSTANCE"></a> | ||
--- | ||
import { Stack, StackProps } from 'aws-cdk-lib'; | ||
import { Construct } from 'constructs'; | ||
export declare enum DatabaseType { | ||
CLUSTER = "Cluster", | ||
INSTANCE = "Instance" | ||
} | ||
export interface ScheduleProperty { | ||
@@ -13,10 +9,11 @@ readonly timezone: string; | ||
} | ||
export interface TargetProperty { | ||
readonly type: DatabaseType; | ||
readonly identifiers: string[]; | ||
readonly stopSchedule: ScheduleProperty; | ||
readonly startSchedule: ScheduleProperty; | ||
export interface TargetResourceProperty { | ||
readonly tagKey: string; | ||
readonly tagValues: string[]; | ||
} | ||
export interface RdsDatabaseRunningScheduleStackProps extends StackProps { | ||
readonly targets: TargetProperty[]; | ||
readonly targetResource: TargetResourceProperty; | ||
readonly enableScheduling?: boolean; | ||
readonly stopSchedule?: ScheduleProperty; | ||
readonly startSchedule?: ScheduleProperty; | ||
} | ||
@@ -23,0 +20,0 @@ export declare class RdsDatabaseRunningScheduleStack extends Stack { |
@@ -44,3 +44,3 @@ { | ||
"@typescript-eslint/parser": "^7", | ||
"aws-cdk-lib": "2.80.0", | ||
"aws-cdk-lib": "2.120.0", | ||
"constructs": "10.0.5", | ||
@@ -52,7 +52,7 @@ "eslint": "^8", | ||
"jest-junit": "^15", | ||
"jsii": "5.4.x", | ||
"jsii": "5.5.x", | ||
"jsii-diff": "^1.102.0", | ||
"jsii-docgen": "^10.4.20", | ||
"jsii-pacmak": "^1.102.0", | ||
"jsii-rosetta": "5.4.x", | ||
"jsii-rosetta": "5.5.x", | ||
"projen": "^0.85.2", | ||
@@ -62,6 +62,6 @@ "standard-version": "^9", | ||
"ts-node": "^10.9.2", | ||
"typescript": "5.4.x" | ||
"typescript": "5.5.x" | ||
}, | ||
"peerDependencies": { | ||
"aws-cdk-lib": "^2.80.0", | ||
"aws-cdk-lib": "^2.120.0", | ||
"constructs": "^10.0.5" | ||
@@ -86,3 +86,3 @@ }, | ||
}, | ||
"version": "1.2.2", | ||
"version": "2.0.0", | ||
"jest": { | ||
@@ -89,0 +89,0 @@ "coverageProvider": "v8", |
@@ -0,1 +1,3 @@ | ||
# AWS RDS Database Running Schedule | ||
[![GitHub](https://img.shields.io/github/license/gammarers/aws-rds-database-running-schedule-stack?style=flat-square)](https://github.com/gammarers/aws-rds-database-running-schedule-stack/blob/main/LICENSE) | ||
@@ -8,6 +10,4 @@ [![npm (scoped)](https://img.shields.io/npm/v/@gammarer/aws-rds-database-running-schedule-stack?style=flat-square)](https://www.npmjs.com/package/@gammarer/aws-rds-database-running-schedule-stack) | ||
# AWS RDS Database Running Scheduler | ||
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. | ||
This is an AWS CDK Construct to make RDS Database running schedule (only running while working hours(start/stop)). | ||
## Fixed | ||
@@ -24,2 +24,4 @@ | ||
- EventBridge Scheduler | ||
- StepFunctions StateMahcine (star or stop controle) | ||
- StepFunctions StateMahcine execution role | ||
@@ -30,8 +32,26 @@ ## Install | ||
#### install by npm | ||
```shell | ||
npm install @gammarers/aws-rds-database-running-schedule-stack | ||
# or | ||
``` | ||
#### install by yarn | ||
```shell | ||
yarn add @gammarers/aws-rds-database-running-schedule-stack | ||
``` | ||
#### install by pnpm | ||
```shell | ||
pnpm add @gammarers/aws-rds-database-running-schedule-stack | ||
``` | ||
#### install by bun | ||
```shell | ||
bun add @gammarers/aws-rds-database-running-schedule-stack | ||
``` | ||
### Python | ||
@@ -55,24 +75,19 @@ | ||
new RdsDatabaseRunningScheduleStack(stack, 'RdsDatabaseRunningScheduleStack', { | ||
targets: [ | ||
{ | ||
type: DatabaseType.CLUSTER, | ||
identifiers: ['db-cluster-1a'], | ||
startSchedule: { | ||
timezone: 'UTC', | ||
}, | ||
stopSchedule: { | ||
timezone: 'UTC', | ||
}, | ||
}, | ||
{ | ||
type: DatabaseType.INSTANCE, | ||
identifiers: ['db-instance-1a'], | ||
startSchedule: { | ||
timezone: 'UTC', | ||
}, | ||
stopSchedule: { | ||
timezone: 'UTC', | ||
}, | ||
}, | ||
], | ||
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', | ||
}, | ||
}); | ||
@@ -79,0 +94,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
258466
396
99