gammarers.aws-rds-database-running-schedule-stack 1.2.1__py3-none-any.whl → 2.0.0__py3-none-any.whl
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.
Potentially problematic release.
This version of gammarers.aws-rds-database-running-schedule-stack might be problematic. Click here for more details.
- gammarers/aws_rds_database_running_scheduler/__init__.py +158 -103
- gammarers/aws_rds_database_running_scheduler/_jsii/__init__.py +2 -2
- gammarers/aws_rds_database_running_scheduler/_jsii/aws-rds-database-running-schedule-stack@2.0.0.jsii.tgz +0 -0
- {gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info → gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info}/METADATA +43 -28
- gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info/RECORD +9 -0
- gammarers/aws_rds_database_running_scheduler/_jsii/aws-rds-database-running-schedule-stack@1.2.1.jsii.tgz +0 -0
- gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info/RECORD +0 -9
- {gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info → gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info}/LICENSE +0 -0
- {gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info → gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info}/WHEEL +0 -0
- {gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info → gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
r'''
|
|
2
|
+
# AWS RDS Database Running Schedule
|
|
3
|
+
|
|
2
4
|
[](https://github.com/gammarers/aws-rds-database-running-schedule-stack/blob/main/LICENSE)
|
|
3
5
|
[](https://www.npmjs.com/package/@gammarer/aws-rds-database-running-schedule-stack)
|
|
4
6
|
[](https://pypi.org/project/gammarer.aws-rds-database-running-schedule-stack/)
|
|
@@ -6,9 +8,7 @@ r'''
|
|
|
6
8
|
[](https://github.com/gammarers/aws-rds-database-running-schedule-stack/actions/workflows/release.yml)
|
|
7
9
|
[](https://github.com/gammarers/aws-rds-database-running-schedule-stack/releases)
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
This is an AWS CDK Construct to make RDS Database running schedule (only running while working hours(start/stop)).
|
|
11
|
+
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.
|
|
12
12
|
|
|
13
13
|
## Fixed
|
|
14
14
|
|
|
@@ -21,17 +21,37 @@ This construct creating resource list.
|
|
|
21
21
|
|
|
22
22
|
* EventBridge Scheduler execution role
|
|
23
23
|
* EventBridge Scheduler
|
|
24
|
+
* StepFunctions StateMahcine (star or stop controle)
|
|
25
|
+
* StepFunctions StateMahcine execution role
|
|
24
26
|
|
|
25
27
|
## Install
|
|
26
28
|
|
|
27
29
|
### TypeScript
|
|
28
30
|
|
|
31
|
+
#### install by npm
|
|
32
|
+
|
|
29
33
|
```shell
|
|
30
34
|
npm install @gammarers/aws-rds-database-running-schedule-stack
|
|
31
|
-
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### install by yarn
|
|
38
|
+
|
|
39
|
+
```shell
|
|
32
40
|
yarn add @gammarers/aws-rds-database-running-schedule-stack
|
|
33
41
|
```
|
|
34
42
|
|
|
43
|
+
#### install by pnpm
|
|
44
|
+
|
|
45
|
+
```shell
|
|
46
|
+
pnpm add @gammarers/aws-rds-database-running-schedule-stack
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### install by bun
|
|
50
|
+
|
|
51
|
+
```shell
|
|
52
|
+
bun add @gammarers/aws-rds-database-running-schedule-stack
|
|
53
|
+
```
|
|
54
|
+
|
|
35
55
|
### Python
|
|
36
56
|
|
|
37
57
|
```shell
|
|
@@ -50,28 +70,23 @@ dotnet add package Gammarers.CDK.AWS.RdsDatabaseRunningScheduleStack
|
|
|
50
70
|
import { RdsDatabaseRunningScheduler, DatabaseType } from '@gammarer/aws-rds-database-running-schedule-stack';
|
|
51
71
|
|
|
52
72
|
new RdsDatabaseRunningScheduleStack(stack, 'RdsDatabaseRunningScheduleStack', {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
stopSchedule: {
|
|
71
|
-
timezone: 'UTC',
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
],
|
|
73
|
+
targetResource: {
|
|
74
|
+
tagKey: 'WorkHoursRunning', // already tagging to rds instance or cluster
|
|
75
|
+
tagValues: ['YES'], // already tagging to rds instance or cluster
|
|
76
|
+
},
|
|
77
|
+
enableScheduling: true,
|
|
78
|
+
startSchedule: {
|
|
79
|
+
timezone: 'Asia/Tokyo',
|
|
80
|
+
minute: '55',
|
|
81
|
+
hour: '8',
|
|
82
|
+
week: 'MON-FRI',
|
|
83
|
+
},
|
|
84
|
+
stopSchedule: {
|
|
85
|
+
timezone: 'Asia/Tokyo',
|
|
86
|
+
minute: '5',
|
|
87
|
+
hour: '19',
|
|
88
|
+
week: 'MON-FRI',
|
|
89
|
+
},
|
|
75
90
|
});
|
|
76
91
|
```
|
|
77
92
|
|
|
@@ -100,12 +115,6 @@ import aws_cdk as _aws_cdk_ceddda9d
|
|
|
100
115
|
import constructs as _constructs_77d1e7e8
|
|
101
116
|
|
|
102
117
|
|
|
103
|
-
@jsii.enum(jsii_type="@gammarers/aws-rds-database-running-schedule-stack.DatabaseType")
|
|
104
|
-
class DatabaseType(enum.Enum):
|
|
105
|
-
CLUSTER = "CLUSTER"
|
|
106
|
-
INSTANCE = "INSTANCE"
|
|
107
|
-
|
|
108
|
-
|
|
109
118
|
class RdsDatabaseRunningScheduleStack(
|
|
110
119
|
_aws_cdk_ceddda9d.Stack,
|
|
111
120
|
metaclass=jsii.JSIIMeta,
|
|
@@ -116,13 +125,17 @@ class RdsDatabaseRunningScheduleStack(
|
|
|
116
125
|
scope: _constructs_77d1e7e8.Construct,
|
|
117
126
|
id: builtins.str,
|
|
118
127
|
*,
|
|
119
|
-
|
|
128
|
+
target_resource: typing.Union["TargetResourceProperty", typing.Dict[builtins.str, typing.Any]],
|
|
129
|
+
enable_scheduling: typing.Optional[builtins.bool] = None,
|
|
130
|
+
start_schedule: typing.Optional[typing.Union["ScheduleProperty", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
131
|
+
stop_schedule: typing.Optional[typing.Union["ScheduleProperty", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
120
132
|
analytics_reporting: typing.Optional[builtins.bool] = None,
|
|
121
133
|
cross_region_references: typing.Optional[builtins.bool] = None,
|
|
122
134
|
description: typing.Optional[builtins.str] = None,
|
|
123
135
|
env: typing.Optional[typing.Union[_aws_cdk_ceddda9d.Environment, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
124
136
|
permissions_boundary: typing.Optional[_aws_cdk_ceddda9d.PermissionsBoundary] = None,
|
|
125
137
|
stack_name: typing.Optional[builtins.str] = None,
|
|
138
|
+
suppress_template_indentation: typing.Optional[builtins.bool] = None,
|
|
126
139
|
synthesizer: typing.Optional[_aws_cdk_ceddda9d.IStackSynthesizer] = None,
|
|
127
140
|
tags: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
|
|
128
141
|
termination_protection: typing.Optional[builtins.bool] = None,
|
|
@@ -130,13 +143,17 @@ class RdsDatabaseRunningScheduleStack(
|
|
|
130
143
|
'''
|
|
131
144
|
:param scope: -
|
|
132
145
|
:param id: -
|
|
133
|
-
:param
|
|
146
|
+
:param target_resource:
|
|
147
|
+
:param enable_scheduling:
|
|
148
|
+
:param start_schedule:
|
|
149
|
+
:param stop_schedule:
|
|
134
150
|
:param analytics_reporting: Include runtime versioning information in this Stack. Default: ``analyticsReporting`` setting of containing ``App``, or value of 'aws:cdk:version-reporting' context key
|
|
135
151
|
:param cross_region_references: Enable this flag to allow native cross region stack references. Enabling this will create a CloudFormation custom resource in both the producing stack and consuming stack in order to perform the export/import This feature is currently experimental Default: false
|
|
136
152
|
:param description: A description of the stack. Default: - No description.
|
|
137
153
|
:param env: The AWS environment (account/region) where this stack will be deployed. Set the ``region``/``account`` fields of ``env`` to either a concrete value to select the indicated environment (recommended for production stacks), or to the values of environment variables ``CDK_DEFAULT_REGION``/``CDK_DEFAULT_ACCOUNT`` to let the target environment depend on the AWS credentials/configuration that the CDK CLI is executed under (recommended for development stacks). If the ``Stack`` is instantiated inside a ``Stage``, any undefined ``region``/``account`` fields from ``env`` will default to the same field on the encompassing ``Stage``, if configured there. If either ``region`` or ``account`` are not set nor inherited from ``Stage``, the Stack will be considered "*environment-agnostic*"". Environment-agnostic stacks can be deployed to any environment but may not be able to take advantage of all features of the CDK. For example, they will not be able to use environmental context lookups such as ``ec2.Vpc.fromLookup`` and will not automatically translate Service Principals to the right format based on the environment's AWS partition, and other such enhancements. Default: - The environment of the containing ``Stage`` if available, otherwise create the stack will be environment-agnostic.
|
|
138
154
|
:param permissions_boundary: Options for applying a permissions boundary to all IAM Roles and Users created within this Stage. Default: - no permissions boundary is applied
|
|
139
155
|
:param stack_name: Name to deploy the stack with. Default: - Derived from construct path.
|
|
156
|
+
:param suppress_template_indentation: 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. Default: - the value of ``@aws-cdk/core:suppressTemplateIndentation``, or ``false`` if that is not set.
|
|
140
157
|
:param synthesizer: Synthesis method to use while deploying this stack. The Stack Synthesizer controls aspects of synthesis and deployment, like how assets are referenced and what IAM roles to use. For more information, see the README of the main CDK package. If not specified, the ``defaultStackSynthesizer`` from ``App`` will be used. If that is not specified, ``DefaultStackSynthesizer`` is used if ``@aws-cdk/core:newStyleStackSynthesis`` is set to ``true`` or the CDK major version is v2. In CDK v1 ``LegacyStackSynthesizer`` is the default if no other synthesizer is specified. Default: - The synthesizer specified on ``App``, or ``DefaultStackSynthesizer`` otherwise.
|
|
141
158
|
:param tags: Stack tags that will be applied to all the taggable resources and the stack itself. Default: {}
|
|
142
159
|
:param termination_protection: Whether to enable termination protection for this stack. Default: false
|
|
@@ -146,13 +163,17 @@ class RdsDatabaseRunningScheduleStack(
|
|
|
146
163
|
check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
|
|
147
164
|
check_type(argname="argument id", value=id, expected_type=type_hints["id"])
|
|
148
165
|
props = RdsDatabaseRunningScheduleStackProps(
|
|
149
|
-
|
|
166
|
+
target_resource=target_resource,
|
|
167
|
+
enable_scheduling=enable_scheduling,
|
|
168
|
+
start_schedule=start_schedule,
|
|
169
|
+
stop_schedule=stop_schedule,
|
|
150
170
|
analytics_reporting=analytics_reporting,
|
|
151
171
|
cross_region_references=cross_region_references,
|
|
152
172
|
description=description,
|
|
153
173
|
env=env,
|
|
154
174
|
permissions_boundary=permissions_boundary,
|
|
155
175
|
stack_name=stack_name,
|
|
176
|
+
suppress_template_indentation=suppress_template_indentation,
|
|
156
177
|
synthesizer=synthesizer,
|
|
157
178
|
tags=tags,
|
|
158
179
|
termination_protection=termination_protection,
|
|
@@ -171,10 +192,14 @@ class RdsDatabaseRunningScheduleStack(
|
|
|
171
192
|
"env": "env",
|
|
172
193
|
"permissions_boundary": "permissionsBoundary",
|
|
173
194
|
"stack_name": "stackName",
|
|
195
|
+
"suppress_template_indentation": "suppressTemplateIndentation",
|
|
174
196
|
"synthesizer": "synthesizer",
|
|
175
197
|
"tags": "tags",
|
|
176
198
|
"termination_protection": "terminationProtection",
|
|
177
|
-
"
|
|
199
|
+
"target_resource": "targetResource",
|
|
200
|
+
"enable_scheduling": "enableScheduling",
|
|
201
|
+
"start_schedule": "startSchedule",
|
|
202
|
+
"stop_schedule": "stopSchedule",
|
|
178
203
|
},
|
|
179
204
|
)
|
|
180
205
|
class RdsDatabaseRunningScheduleStackProps(_aws_cdk_ceddda9d.StackProps):
|
|
@@ -187,10 +212,14 @@ class RdsDatabaseRunningScheduleStackProps(_aws_cdk_ceddda9d.StackProps):
|
|
|
187
212
|
env: typing.Optional[typing.Union[_aws_cdk_ceddda9d.Environment, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
188
213
|
permissions_boundary: typing.Optional[_aws_cdk_ceddda9d.PermissionsBoundary] = None,
|
|
189
214
|
stack_name: typing.Optional[builtins.str] = None,
|
|
215
|
+
suppress_template_indentation: typing.Optional[builtins.bool] = None,
|
|
190
216
|
synthesizer: typing.Optional[_aws_cdk_ceddda9d.IStackSynthesizer] = None,
|
|
191
217
|
tags: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
|
|
192
218
|
termination_protection: typing.Optional[builtins.bool] = None,
|
|
193
|
-
|
|
219
|
+
target_resource: typing.Union["TargetResourceProperty", typing.Dict[builtins.str, typing.Any]],
|
|
220
|
+
enable_scheduling: typing.Optional[builtins.bool] = None,
|
|
221
|
+
start_schedule: typing.Optional[typing.Union["ScheduleProperty", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
222
|
+
stop_schedule: typing.Optional[typing.Union["ScheduleProperty", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
194
223
|
) -> None:
|
|
195
224
|
'''
|
|
196
225
|
:param analytics_reporting: Include runtime versioning information in this Stack. Default: ``analyticsReporting`` setting of containing ``App``, or value of 'aws:cdk:version-reporting' context key
|
|
@@ -199,13 +228,23 @@ class RdsDatabaseRunningScheduleStackProps(_aws_cdk_ceddda9d.StackProps):
|
|
|
199
228
|
:param env: The AWS environment (account/region) where this stack will be deployed. Set the ``region``/``account`` fields of ``env`` to either a concrete value to select the indicated environment (recommended for production stacks), or to the values of environment variables ``CDK_DEFAULT_REGION``/``CDK_DEFAULT_ACCOUNT`` to let the target environment depend on the AWS credentials/configuration that the CDK CLI is executed under (recommended for development stacks). If the ``Stack`` is instantiated inside a ``Stage``, any undefined ``region``/``account`` fields from ``env`` will default to the same field on the encompassing ``Stage``, if configured there. If either ``region`` or ``account`` are not set nor inherited from ``Stage``, the Stack will be considered "*environment-agnostic*"". Environment-agnostic stacks can be deployed to any environment but may not be able to take advantage of all features of the CDK. For example, they will not be able to use environmental context lookups such as ``ec2.Vpc.fromLookup`` and will not automatically translate Service Principals to the right format based on the environment's AWS partition, and other such enhancements. Default: - The environment of the containing ``Stage`` if available, otherwise create the stack will be environment-agnostic.
|
|
200
229
|
:param permissions_boundary: Options for applying a permissions boundary to all IAM Roles and Users created within this Stage. Default: - no permissions boundary is applied
|
|
201
230
|
:param stack_name: Name to deploy the stack with. Default: - Derived from construct path.
|
|
231
|
+
:param suppress_template_indentation: 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. Default: - the value of ``@aws-cdk/core:suppressTemplateIndentation``, or ``false`` if that is not set.
|
|
202
232
|
:param synthesizer: Synthesis method to use while deploying this stack. The Stack Synthesizer controls aspects of synthesis and deployment, like how assets are referenced and what IAM roles to use. For more information, see the README of the main CDK package. If not specified, the ``defaultStackSynthesizer`` from ``App`` will be used. If that is not specified, ``DefaultStackSynthesizer`` is used if ``@aws-cdk/core:newStyleStackSynthesis`` is set to ``true`` or the CDK major version is v2. In CDK v1 ``LegacyStackSynthesizer`` is the default if no other synthesizer is specified. Default: - The synthesizer specified on ``App``, or ``DefaultStackSynthesizer`` otherwise.
|
|
203
233
|
:param tags: Stack tags that will be applied to all the taggable resources and the stack itself. Default: {}
|
|
204
234
|
:param termination_protection: Whether to enable termination protection for this stack. Default: false
|
|
205
|
-
:param
|
|
235
|
+
:param target_resource:
|
|
236
|
+
:param enable_scheduling:
|
|
237
|
+
:param start_schedule:
|
|
238
|
+
:param stop_schedule:
|
|
206
239
|
'''
|
|
207
240
|
if isinstance(env, dict):
|
|
208
241
|
env = _aws_cdk_ceddda9d.Environment(**env)
|
|
242
|
+
if isinstance(target_resource, dict):
|
|
243
|
+
target_resource = TargetResourceProperty(**target_resource)
|
|
244
|
+
if isinstance(start_schedule, dict):
|
|
245
|
+
start_schedule = ScheduleProperty(**start_schedule)
|
|
246
|
+
if isinstance(stop_schedule, dict):
|
|
247
|
+
stop_schedule = ScheduleProperty(**stop_schedule)
|
|
209
248
|
if __debug__:
|
|
210
249
|
type_hints = typing.get_type_hints(_typecheckingstub__8f71acba171212e7096d4e05bc27262d7d2c04637e38863513660ca9289e5599)
|
|
211
250
|
check_type(argname="argument analytics_reporting", value=analytics_reporting, expected_type=type_hints["analytics_reporting"])
|
|
@@ -214,12 +253,16 @@ class RdsDatabaseRunningScheduleStackProps(_aws_cdk_ceddda9d.StackProps):
|
|
|
214
253
|
check_type(argname="argument env", value=env, expected_type=type_hints["env"])
|
|
215
254
|
check_type(argname="argument permissions_boundary", value=permissions_boundary, expected_type=type_hints["permissions_boundary"])
|
|
216
255
|
check_type(argname="argument stack_name", value=stack_name, expected_type=type_hints["stack_name"])
|
|
256
|
+
check_type(argname="argument suppress_template_indentation", value=suppress_template_indentation, expected_type=type_hints["suppress_template_indentation"])
|
|
217
257
|
check_type(argname="argument synthesizer", value=synthesizer, expected_type=type_hints["synthesizer"])
|
|
218
258
|
check_type(argname="argument tags", value=tags, expected_type=type_hints["tags"])
|
|
219
259
|
check_type(argname="argument termination_protection", value=termination_protection, expected_type=type_hints["termination_protection"])
|
|
220
|
-
check_type(argname="argument
|
|
260
|
+
check_type(argname="argument target_resource", value=target_resource, expected_type=type_hints["target_resource"])
|
|
261
|
+
check_type(argname="argument enable_scheduling", value=enable_scheduling, expected_type=type_hints["enable_scheduling"])
|
|
262
|
+
check_type(argname="argument start_schedule", value=start_schedule, expected_type=type_hints["start_schedule"])
|
|
263
|
+
check_type(argname="argument stop_schedule", value=stop_schedule, expected_type=type_hints["stop_schedule"])
|
|
221
264
|
self._values: typing.Dict[builtins.str, typing.Any] = {
|
|
222
|
-
"
|
|
265
|
+
"target_resource": target_resource,
|
|
223
266
|
}
|
|
224
267
|
if analytics_reporting is not None:
|
|
225
268
|
self._values["analytics_reporting"] = analytics_reporting
|
|
@@ -233,12 +276,20 @@ class RdsDatabaseRunningScheduleStackProps(_aws_cdk_ceddda9d.StackProps):
|
|
|
233
276
|
self._values["permissions_boundary"] = permissions_boundary
|
|
234
277
|
if stack_name is not None:
|
|
235
278
|
self._values["stack_name"] = stack_name
|
|
279
|
+
if suppress_template_indentation is not None:
|
|
280
|
+
self._values["suppress_template_indentation"] = suppress_template_indentation
|
|
236
281
|
if synthesizer is not None:
|
|
237
282
|
self._values["synthesizer"] = synthesizer
|
|
238
283
|
if tags is not None:
|
|
239
284
|
self._values["tags"] = tags
|
|
240
285
|
if termination_protection is not None:
|
|
241
286
|
self._values["termination_protection"] = termination_protection
|
|
287
|
+
if enable_scheduling is not None:
|
|
288
|
+
self._values["enable_scheduling"] = enable_scheduling
|
|
289
|
+
if start_schedule is not None:
|
|
290
|
+
self._values["start_schedule"] = start_schedule
|
|
291
|
+
if stop_schedule is not None:
|
|
292
|
+
self._values["stop_schedule"] = stop_schedule
|
|
242
293
|
|
|
243
294
|
@builtins.property
|
|
244
295
|
def analytics_reporting(self) -> typing.Optional[builtins.bool]:
|
|
@@ -365,6 +416,19 @@ class RdsDatabaseRunningScheduleStackProps(_aws_cdk_ceddda9d.StackProps):
|
|
|
365
416
|
result = self._values.get("stack_name")
|
|
366
417
|
return typing.cast(typing.Optional[builtins.str], result)
|
|
367
418
|
|
|
419
|
+
@builtins.property
|
|
420
|
+
def suppress_template_indentation(self) -> typing.Optional[builtins.bool]:
|
|
421
|
+
'''Enable this flag to suppress indentation in generated CloudFormation templates.
|
|
422
|
+
|
|
423
|
+
If not specified, the value of the ``@aws-cdk/core:suppressTemplateIndentation``
|
|
424
|
+
context key will be used. If that is not specified, then the
|
|
425
|
+
default value ``false`` will be used.
|
|
426
|
+
|
|
427
|
+
:default: - the value of ``@aws-cdk/core:suppressTemplateIndentation``, or ``false`` if that is not set.
|
|
428
|
+
'''
|
|
429
|
+
result = self._values.get("suppress_template_indentation")
|
|
430
|
+
return typing.cast(typing.Optional[builtins.bool], result)
|
|
431
|
+
|
|
368
432
|
@builtins.property
|
|
369
433
|
def synthesizer(self) -> typing.Optional[_aws_cdk_ceddda9d.IStackSynthesizer]:
|
|
370
434
|
'''Synthesis method to use while deploying this stack.
|
|
@@ -403,10 +467,25 @@ class RdsDatabaseRunningScheduleStackProps(_aws_cdk_ceddda9d.StackProps):
|
|
|
403
467
|
return typing.cast(typing.Optional[builtins.bool], result)
|
|
404
468
|
|
|
405
469
|
@builtins.property
|
|
406
|
-
def
|
|
407
|
-
result = self._values.get("
|
|
408
|
-
assert result is not None, "Required property '
|
|
409
|
-
return typing.cast(
|
|
470
|
+
def target_resource(self) -> "TargetResourceProperty":
|
|
471
|
+
result = self._values.get("target_resource")
|
|
472
|
+
assert result is not None, "Required property 'target_resource' is missing"
|
|
473
|
+
return typing.cast("TargetResourceProperty", result)
|
|
474
|
+
|
|
475
|
+
@builtins.property
|
|
476
|
+
def enable_scheduling(self) -> typing.Optional[builtins.bool]:
|
|
477
|
+
result = self._values.get("enable_scheduling")
|
|
478
|
+
return typing.cast(typing.Optional[builtins.bool], result)
|
|
479
|
+
|
|
480
|
+
@builtins.property
|
|
481
|
+
def start_schedule(self) -> typing.Optional["ScheduleProperty"]:
|
|
482
|
+
result = self._values.get("start_schedule")
|
|
483
|
+
return typing.cast(typing.Optional["ScheduleProperty"], result)
|
|
484
|
+
|
|
485
|
+
@builtins.property
|
|
486
|
+
def stop_schedule(self) -> typing.Optional["ScheduleProperty"]:
|
|
487
|
+
result = self._values.get("stop_schedule")
|
|
488
|
+
return typing.cast(typing.Optional["ScheduleProperty"], result)
|
|
410
489
|
|
|
411
490
|
def __eq__(self, rhs: typing.Any) -> builtins.bool:
|
|
412
491
|
return isinstance(rhs, self.__class__) and rhs._values == self._values
|
|
@@ -495,70 +574,41 @@ class ScheduleProperty:
|
|
|
495
574
|
|
|
496
575
|
|
|
497
576
|
@jsii.data_type(
|
|
498
|
-
jsii_type="@gammarers/aws-rds-database-running-schedule-stack.
|
|
577
|
+
jsii_type="@gammarers/aws-rds-database-running-schedule-stack.TargetResourceProperty",
|
|
499
578
|
jsii_struct_bases=[],
|
|
500
|
-
name_mapping={
|
|
501
|
-
"identifiers": "identifiers",
|
|
502
|
-
"start_schedule": "startSchedule",
|
|
503
|
-
"stop_schedule": "stopSchedule",
|
|
504
|
-
"type": "type",
|
|
505
|
-
},
|
|
579
|
+
name_mapping={"tag_key": "tagKey", "tag_values": "tagValues"},
|
|
506
580
|
)
|
|
507
|
-
class
|
|
581
|
+
class TargetResourceProperty:
|
|
508
582
|
def __init__(
|
|
509
583
|
self,
|
|
510
584
|
*,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
stop_schedule: typing.Union[ScheduleProperty, typing.Dict[builtins.str, typing.Any]],
|
|
514
|
-
type: DatabaseType,
|
|
585
|
+
tag_key: builtins.str,
|
|
586
|
+
tag_values: typing.Sequence[builtins.str],
|
|
515
587
|
) -> None:
|
|
516
588
|
'''
|
|
517
|
-
:param
|
|
518
|
-
:param
|
|
519
|
-
:param stop_schedule:
|
|
520
|
-
:param type:
|
|
589
|
+
:param tag_key:
|
|
590
|
+
:param tag_values:
|
|
521
591
|
'''
|
|
522
|
-
if isinstance(start_schedule, dict):
|
|
523
|
-
start_schedule = ScheduleProperty(**start_schedule)
|
|
524
|
-
if isinstance(stop_schedule, dict):
|
|
525
|
-
stop_schedule = ScheduleProperty(**stop_schedule)
|
|
526
592
|
if __debug__:
|
|
527
|
-
type_hints = typing.get_type_hints(
|
|
528
|
-
check_type(argname="argument
|
|
529
|
-
check_type(argname="argument
|
|
530
|
-
check_type(argname="argument stop_schedule", value=stop_schedule, expected_type=type_hints["stop_schedule"])
|
|
531
|
-
check_type(argname="argument type", value=type, expected_type=type_hints["type"])
|
|
593
|
+
type_hints = typing.get_type_hints(_typecheckingstub__8591c95e42de5a4e537e0f91a2110f72b09d18b72008139e5e23a0d230607030)
|
|
594
|
+
check_type(argname="argument tag_key", value=tag_key, expected_type=type_hints["tag_key"])
|
|
595
|
+
check_type(argname="argument tag_values", value=tag_values, expected_type=type_hints["tag_values"])
|
|
532
596
|
self._values: typing.Dict[builtins.str, typing.Any] = {
|
|
533
|
-
"
|
|
534
|
-
"
|
|
535
|
-
"stop_schedule": stop_schedule,
|
|
536
|
-
"type": type,
|
|
597
|
+
"tag_key": tag_key,
|
|
598
|
+
"tag_values": tag_values,
|
|
537
599
|
}
|
|
538
600
|
|
|
539
601
|
@builtins.property
|
|
540
|
-
def
|
|
541
|
-
result = self._values.get("
|
|
542
|
-
assert result is not None, "Required property '
|
|
543
|
-
return typing.cast(
|
|
544
|
-
|
|
545
|
-
@builtins.property
|
|
546
|
-
def start_schedule(self) -> ScheduleProperty:
|
|
547
|
-
result = self._values.get("start_schedule")
|
|
548
|
-
assert result is not None, "Required property 'start_schedule' is missing"
|
|
549
|
-
return typing.cast(ScheduleProperty, result)
|
|
550
|
-
|
|
551
|
-
@builtins.property
|
|
552
|
-
def stop_schedule(self) -> ScheduleProperty:
|
|
553
|
-
result = self._values.get("stop_schedule")
|
|
554
|
-
assert result is not None, "Required property 'stop_schedule' is missing"
|
|
555
|
-
return typing.cast(ScheduleProperty, result)
|
|
602
|
+
def tag_key(self) -> builtins.str:
|
|
603
|
+
result = self._values.get("tag_key")
|
|
604
|
+
assert result is not None, "Required property 'tag_key' is missing"
|
|
605
|
+
return typing.cast(builtins.str, result)
|
|
556
606
|
|
|
557
607
|
@builtins.property
|
|
558
|
-
def
|
|
559
|
-
result = self._values.get("
|
|
560
|
-
assert result is not None, "Required property '
|
|
561
|
-
return typing.cast(
|
|
608
|
+
def tag_values(self) -> typing.List[builtins.str]:
|
|
609
|
+
result = self._values.get("tag_values")
|
|
610
|
+
assert result is not None, "Required property 'tag_values' is missing"
|
|
611
|
+
return typing.cast(typing.List[builtins.str], result)
|
|
562
612
|
|
|
563
613
|
def __eq__(self, rhs: typing.Any) -> builtins.bool:
|
|
564
614
|
return isinstance(rhs, self.__class__) and rhs._values == self._values
|
|
@@ -567,17 +617,16 @@ class TargetProperty:
|
|
|
567
617
|
return not (rhs == self)
|
|
568
618
|
|
|
569
619
|
def __repr__(self) -> str:
|
|
570
|
-
return "
|
|
620
|
+
return "TargetResourceProperty(%s)" % ", ".join(
|
|
571
621
|
k + "=" + repr(v) for k, v in self._values.items()
|
|
572
622
|
)
|
|
573
623
|
|
|
574
624
|
|
|
575
625
|
__all__ = [
|
|
576
|
-
"DatabaseType",
|
|
577
626
|
"RdsDatabaseRunningScheduleStack",
|
|
578
627
|
"RdsDatabaseRunningScheduleStackProps",
|
|
579
628
|
"ScheduleProperty",
|
|
580
|
-
"
|
|
629
|
+
"TargetResourceProperty",
|
|
581
630
|
]
|
|
582
631
|
|
|
583
632
|
publication.publish()
|
|
@@ -586,13 +635,17 @@ def _typecheckingstub__6fffbb5d99d9dae64eeda4fe6ceb7a65d991f000e6cc360aa27fa2514
|
|
|
586
635
|
scope: _constructs_77d1e7e8.Construct,
|
|
587
636
|
id: builtins.str,
|
|
588
637
|
*,
|
|
589
|
-
|
|
638
|
+
target_resource: typing.Union[TargetResourceProperty, typing.Dict[builtins.str, typing.Any]],
|
|
639
|
+
enable_scheduling: typing.Optional[builtins.bool] = None,
|
|
640
|
+
start_schedule: typing.Optional[typing.Union[ScheduleProperty, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
641
|
+
stop_schedule: typing.Optional[typing.Union[ScheduleProperty, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
590
642
|
analytics_reporting: typing.Optional[builtins.bool] = None,
|
|
591
643
|
cross_region_references: typing.Optional[builtins.bool] = None,
|
|
592
644
|
description: typing.Optional[builtins.str] = None,
|
|
593
645
|
env: typing.Optional[typing.Union[_aws_cdk_ceddda9d.Environment, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
594
646
|
permissions_boundary: typing.Optional[_aws_cdk_ceddda9d.PermissionsBoundary] = None,
|
|
595
647
|
stack_name: typing.Optional[builtins.str] = None,
|
|
648
|
+
suppress_template_indentation: typing.Optional[builtins.bool] = None,
|
|
596
649
|
synthesizer: typing.Optional[_aws_cdk_ceddda9d.IStackSynthesizer] = None,
|
|
597
650
|
tags: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
|
|
598
651
|
termination_protection: typing.Optional[builtins.bool] = None,
|
|
@@ -608,10 +661,14 @@ def _typecheckingstub__8f71acba171212e7096d4e05bc27262d7d2c04637e38863513660ca92
|
|
|
608
661
|
env: typing.Optional[typing.Union[_aws_cdk_ceddda9d.Environment, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
609
662
|
permissions_boundary: typing.Optional[_aws_cdk_ceddda9d.PermissionsBoundary] = None,
|
|
610
663
|
stack_name: typing.Optional[builtins.str] = None,
|
|
664
|
+
suppress_template_indentation: typing.Optional[builtins.bool] = None,
|
|
611
665
|
synthesizer: typing.Optional[_aws_cdk_ceddda9d.IStackSynthesizer] = None,
|
|
612
666
|
tags: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
|
|
613
667
|
termination_protection: typing.Optional[builtins.bool] = None,
|
|
614
|
-
|
|
668
|
+
target_resource: typing.Union[TargetResourceProperty, typing.Dict[builtins.str, typing.Any]],
|
|
669
|
+
enable_scheduling: typing.Optional[builtins.bool] = None,
|
|
670
|
+
start_schedule: typing.Optional[typing.Union[ScheduleProperty, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
671
|
+
stop_schedule: typing.Optional[typing.Union[ScheduleProperty, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
615
672
|
) -> None:
|
|
616
673
|
"""Type checking stubs"""
|
|
617
674
|
pass
|
|
@@ -626,12 +683,10 @@ def _typecheckingstub__698ada8cebb0f29cf7aa1b64e0b10a701ff87508b556665b4c2bae69b
|
|
|
626
683
|
"""Type checking stubs"""
|
|
627
684
|
pass
|
|
628
685
|
|
|
629
|
-
def
|
|
686
|
+
def _typecheckingstub__8591c95e42de5a4e537e0f91a2110f72b09d18b72008139e5e23a0d230607030(
|
|
630
687
|
*,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
stop_schedule: typing.Union[ScheduleProperty, typing.Dict[builtins.str, typing.Any]],
|
|
634
|
-
type: DatabaseType,
|
|
688
|
+
tag_key: builtins.str,
|
|
689
|
+
tag_values: typing.Sequence[builtins.str],
|
|
635
690
|
) -> None:
|
|
636
691
|
"""Type checking stubs"""
|
|
637
692
|
pass
|
|
@@ -18,9 +18,9 @@ import constructs._jsii
|
|
|
18
18
|
|
|
19
19
|
__jsii_assembly__ = jsii.JSIIAssembly.load(
|
|
20
20
|
"@gammarers/aws-rds-database-running-schedule-stack",
|
|
21
|
-
"
|
|
21
|
+
"2.0.0",
|
|
22
22
|
__name__[0:-6],
|
|
23
|
-
"aws-rds-database-running-schedule-stack@
|
|
23
|
+
"aws-rds-database-running-schedule-stack@2.0.0.jsii.tgz",
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
__all__ = [
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gammarers.aws-rds-database-running-schedule-stack
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: AWS RDS Database Running Scheduler
|
|
5
5
|
Home-page: https://github.com/gammarers/aws-rds-database-running-schedule-stack.git
|
|
6
6
|
Author: yicr<yicr@users.noreply.github.com>
|
|
@@ -20,12 +20,14 @@ Classifier: License :: OSI Approved
|
|
|
20
20
|
Requires-Python: ~=3.8
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: aws-cdk-lib<3.0.0,>=2.
|
|
23
|
+
Requires-Dist: aws-cdk-lib<3.0.0,>=2.120.0
|
|
24
24
|
Requires-Dist: constructs<11.0.0,>=10.0.5
|
|
25
25
|
Requires-Dist: jsii<2.0.0,>=1.102.0
|
|
26
26
|
Requires-Dist: publication>=0.0.3
|
|
27
27
|
Requires-Dist: typeguard~=2.13.3
|
|
28
28
|
|
|
29
|
+
# AWS RDS Database Running Schedule
|
|
30
|
+
|
|
29
31
|
[](https://github.com/gammarers/aws-rds-database-running-schedule-stack/blob/main/LICENSE)
|
|
30
32
|
[](https://www.npmjs.com/package/@gammarer/aws-rds-database-running-schedule-stack)
|
|
31
33
|
[](https://pypi.org/project/gammarer.aws-rds-database-running-schedule-stack/)
|
|
@@ -33,9 +35,7 @@ Requires-Dist: typeguard~=2.13.3
|
|
|
33
35
|
[](https://github.com/gammarers/aws-rds-database-running-schedule-stack/actions/workflows/release.yml)
|
|
34
36
|
[](https://github.com/gammarers/aws-rds-database-running-schedule-stack/releases)
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
This is an AWS CDK Construct to make RDS Database running schedule (only running while working hours(start/stop)).
|
|
38
|
+
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.
|
|
39
39
|
|
|
40
40
|
## Fixed
|
|
41
41
|
|
|
@@ -48,17 +48,37 @@ This construct creating resource list.
|
|
|
48
48
|
|
|
49
49
|
* EventBridge Scheduler execution role
|
|
50
50
|
* EventBridge Scheduler
|
|
51
|
+
* StepFunctions StateMahcine (star or stop controle)
|
|
52
|
+
* StepFunctions StateMahcine execution role
|
|
51
53
|
|
|
52
54
|
## Install
|
|
53
55
|
|
|
54
56
|
### TypeScript
|
|
55
57
|
|
|
58
|
+
#### install by npm
|
|
59
|
+
|
|
56
60
|
```shell
|
|
57
61
|
npm install @gammarers/aws-rds-database-running-schedule-stack
|
|
58
|
-
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### install by yarn
|
|
65
|
+
|
|
66
|
+
```shell
|
|
59
67
|
yarn add @gammarers/aws-rds-database-running-schedule-stack
|
|
60
68
|
```
|
|
61
69
|
|
|
70
|
+
#### install by pnpm
|
|
71
|
+
|
|
72
|
+
```shell
|
|
73
|
+
pnpm add @gammarers/aws-rds-database-running-schedule-stack
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### install by bun
|
|
77
|
+
|
|
78
|
+
```shell
|
|
79
|
+
bun add @gammarers/aws-rds-database-running-schedule-stack
|
|
80
|
+
```
|
|
81
|
+
|
|
62
82
|
### Python
|
|
63
83
|
|
|
64
84
|
```shell
|
|
@@ -77,28 +97,23 @@ dotnet add package Gammarers.CDK.AWS.RdsDatabaseRunningScheduleStack
|
|
|
77
97
|
import { RdsDatabaseRunningScheduler, DatabaseType } from '@gammarer/aws-rds-database-running-schedule-stack';
|
|
78
98
|
|
|
79
99
|
new RdsDatabaseRunningScheduleStack(stack, 'RdsDatabaseRunningScheduleStack', {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
stopSchedule: {
|
|
98
|
-
timezone: 'UTC',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
],
|
|
100
|
+
targetResource: {
|
|
101
|
+
tagKey: 'WorkHoursRunning', // already tagging to rds instance or cluster
|
|
102
|
+
tagValues: ['YES'], // already tagging to rds instance or cluster
|
|
103
|
+
},
|
|
104
|
+
enableScheduling: true,
|
|
105
|
+
startSchedule: {
|
|
106
|
+
timezone: 'Asia/Tokyo',
|
|
107
|
+
minute: '55',
|
|
108
|
+
hour: '8',
|
|
109
|
+
week: 'MON-FRI',
|
|
110
|
+
},
|
|
111
|
+
stopSchedule: {
|
|
112
|
+
timezone: 'Asia/Tokyo',
|
|
113
|
+
minute: '5',
|
|
114
|
+
hour: '19',
|
|
115
|
+
week: 'MON-FRI',
|
|
116
|
+
},
|
|
102
117
|
});
|
|
103
118
|
```
|
|
104
119
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
gammarers/aws_rds_database_running_scheduler/__init__.py,sha256=ed8H-Ox8GH4nRUNgoOnDt43d5fKjlzxf8gaSNiDAmvM,36553
|
|
2
|
+
gammarers/aws_rds_database_running_scheduler/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
3
|
+
gammarers/aws_rds_database_running_scheduler/_jsii/__init__.py,sha256=XcBfBiqhj1xJhnhz8pb7dNdIhrhPDJpy5mzu5M2YH2A,545
|
|
4
|
+
gammarers/aws_rds_database_running_scheduler/_jsii/aws-rds-database-running-schedule-stack@2.0.0.jsii.tgz,sha256=vZj-2LmEdqi79tB74gBVvddC6O16ulTYYFihbyHNJi8,38794
|
|
5
|
+
gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
6
|
+
gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info/METADATA,sha256=yrC6q-B73Dr-OlNIcNfvsM0Ssg3Uaw-QuQv1rLhB1GI,4457
|
|
7
|
+
gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
8
|
+
gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info/top_level.txt,sha256=aYHffMrt-8dtQoLeNk0M8OeqbA0a5gMcnNm5hL7OMHk,10
|
|
9
|
+
gammarers.aws_rds_database_running_schedule_stack-2.0.0.dist-info/RECORD,,
|
|
Binary file
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
gammarers/aws_rds_database_running_scheduler/__init__.py,sha256=I5C4KAWL8UK8PiokWSWXOH_peFWn0LXXQrOAUP3tj94,32049
|
|
2
|
-
gammarers/aws_rds_database_running_scheduler/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
3
|
-
gammarers/aws_rds_database_running_scheduler/_jsii/__init__.py,sha256=l-rRZmTkMfGHa97en1XqRnzR7at3jz_odkdX-5_G0S0,545
|
|
4
|
-
gammarers/aws_rds_database_running_scheduler/_jsii/aws-rds-database-running-schedule-stack@1.2.1.jsii.tgz,sha256=qK2AxZSPLqSl2vaD6N-8LvdshqP7GDu9eXH79Opnl7w,30736
|
|
5
|
-
gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
6
|
-
gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info/METADATA,sha256=dpOkv1VTAxScZR1-7jSD2IJF520pvs_5JSKm4UghXg0,3861
|
|
7
|
-
gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
8
|
-
gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info/top_level.txt,sha256=aYHffMrt-8dtQoLeNk0M8OeqbA0a5gMcnNm5hL7OMHk,10
|
|
9
|
-
gammarers.aws_rds_database_running_schedule_stack-1.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|