ec2-instance-running-scheduler 0.2.6 → 0.3.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/.jsii +357 -47
- package/API.md +402 -27
- package/README.md +55 -17
- package/assets/funcs/running-scheduler.lambda/index.js +333 -212
- package/assets/funcs/running-scheduler.lambda/index.js.map +4 -4
- package/lib/constructs/ec2-instance-running-scheduler.d.ts +31 -14
- package/lib/constructs/ec2-instance-running-scheduler.js +26 -13
- package/lib/constructs/running-scheduler-failure-detection.d.ts +87 -0
- package/lib/constructs/running-scheduler-failure-detection.js +185 -0
- package/lib/funcs/running-scheduler-predicates.d.ts +24 -24
- package/lib/funcs/running-scheduler-predicates.js +18 -18
- package/lib/funcs/running-scheduler-wait-config.d.ts +17 -0
- package/lib/funcs/running-scheduler-wait-config.js +21 -0
- package/lib/funcs/running-scheduler-wait-env.d.ts +9 -0
- package/lib/funcs/running-scheduler-wait-env.js +54 -0
- package/lib/funcs/running-scheduler.lambda.d.ts +11 -4
- package/lib/funcs/running-scheduler.lambda.js +88 -50
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -2
- package/lib/stacks/ec2-instance-running-schedule-stack.d.ts +9 -3
- package/lib/stacks/ec2-instance-running-schedule-stack.js +8 -3
- package/package.json +8 -9
- package/lib/funcs/running-scheduler-polling-config.d.ts +0 -17
- package/lib/funcs/running-scheduler-polling-config.js +0 -21
- package/lib/funcs/running-scheduler-polling-env.d.ts +0 -8
- package/lib/funcs/running-scheduler-polling-env.js +0 -53
package/API.md
CHANGED
|
@@ -9,8 +9,9 @@ Provisions EventBridge Scheduler rules and a Durable Execution Lambda that start
|
|
|
9
9
|
Each schedule invokes the function with `Params` (`TagKey`, `TagValues`, `Mode`). The function uses
|
|
10
10
|
the Resource Groups Tagging API and EC2 APIs; Slack notifications use the secret named in {@link Secrets.slackSecretName}.
|
|
11
11
|
|
|
12
|
-
Per-instance
|
|
13
|
-
and enforced in the handler before the Durable execution timeout.
|
|
12
|
+
Per-instance wait timeouts are configured via {@link EC2InstanceRunningSchedulerProps.resourceWait}
|
|
13
|
+
and enforced in the handler before the Durable execution timeout. Optional CloudWatch failure
|
|
14
|
+
detection is available via {@link EC2InstanceRunningSchedulerProps.failureDetection}.
|
|
14
15
|
|
|
15
16
|
#### Initializers <a name="Initializers" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduler.Initializer"></a>
|
|
16
17
|
|
|
@@ -24,7 +25,7 @@ new EC2InstanceRunningScheduler(scope: Construct, id: string, props: EC2Instance
|
|
|
24
25
|
| --- | --- | --- |
|
|
25
26
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduler.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | - Parent construct. |
|
|
26
27
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduler.Initializer.parameter.id">id</a></code> | <code>string</code> | - Construct id. |
|
|
27
|
-
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduler.Initializer.parameter.props">props</a></code> | <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps">EC2InstanceRunningSchedulerProps</a></code> | - Target tags, schedules, Slack secret, schedule enable flag, and optional {@link
|
|
28
|
+
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduler.Initializer.parameter.props">props</a></code> | <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps">EC2InstanceRunningSchedulerProps</a></code> | - Target tags, schedules, Slack secret, schedule enable flag, optional {@link ResourceWaitLimits}, and optional {@link FailureDetectionAlarms}. |
|
|
28
29
|
|
|
29
30
|
---
|
|
30
31
|
|
|
@@ -48,7 +49,7 @@ Construct id.
|
|
|
48
49
|
|
|
49
50
|
- *Type:* <a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps">EC2InstanceRunningSchedulerProps</a>
|
|
50
51
|
|
|
51
|
-
Target tags, schedules, Slack secret, schedule enable flag, and optional {@link
|
|
52
|
+
Target tags, schedules, Slack secret, schedule enable flag, optional {@link ResourceWaitLimits}, and optional {@link FailureDetectionAlarms}.
|
|
52
53
|
|
|
53
54
|
---
|
|
54
55
|
|
|
@@ -135,6 +136,7 @@ Any object.
|
|
|
135
136
|
| **Name** | **Type** | **Description** |
|
|
136
137
|
| --- | --- | --- |
|
|
137
138
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduler.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
139
|
+
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduler.property.failureDetection">failureDetection</a></code> | <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection">RunningSchedulerFailureDetection</a></code> | Failure detection alarms, when {@link EC2InstanceRunningSchedulerProps.failureDetection} is enabled. |
|
|
138
140
|
|
|
139
141
|
---
|
|
140
142
|
|
|
@@ -150,11 +152,27 @@ The tree node.
|
|
|
150
152
|
|
|
151
153
|
---
|
|
152
154
|
|
|
155
|
+
##### `failureDetection`<sup>Optional</sup> <a name="failureDetection" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduler.property.failureDetection"></a>
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
public readonly failureDetection: RunningSchedulerFailureDetection;
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- *Type:* <a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection">RunningSchedulerFailureDetection</a>
|
|
162
|
+
|
|
163
|
+
Failure detection alarms, when {@link EC2InstanceRunningSchedulerProps.failureDetection} is enabled.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
153
167
|
|
|
154
168
|
### EC2InstanceRunningScheduleStack <a name="EC2InstanceRunningScheduleStack" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack"></a>
|
|
155
169
|
|
|
156
170
|
CDK stack that deploys the EC2 instance running scheduler (EventBridge Scheduler + Durable Lambda).
|
|
157
171
|
|
|
172
|
+
Wires {@link EC2InstanceRunningScheduler} with targeting, schedules, secrets, scheduling toggle,
|
|
173
|
+
and optional {@link FailureDetectionAlarms}. Does not expose {@link ResourceWaitLimits }; use the
|
|
174
|
+
construct directly when custom per-instance wait limits are required.
|
|
175
|
+
|
|
158
176
|
#### Initializers <a name="Initializers" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer"></a>
|
|
159
177
|
|
|
160
178
|
```typescript
|
|
@@ -167,7 +185,7 @@ new EC2InstanceRunningScheduleStack(scope: Construct, id: string, props: EC2Inst
|
|
|
167
185
|
| --- | --- | --- |
|
|
168
186
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | - Parent construct or app. |
|
|
169
187
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer.parameter.id">id</a></code> | <code>string</code> | - Stack id. |
|
|
170
|
-
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer.parameter.props">props</a></code> | <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps">EC2InstanceRunningScheduleStackProps</a></code> | - Target resource, schedules, secrets, and standard stack props. |
|
|
188
|
+
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer.parameter.props">props</a></code> | <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps">EC2InstanceRunningScheduleStackProps</a></code> | - Target resource, schedules, secrets, optional failure detection, and standard stack props. |
|
|
171
189
|
|
|
172
190
|
---
|
|
173
191
|
|
|
@@ -191,7 +209,7 @@ Stack id.
|
|
|
191
209
|
|
|
192
210
|
- *Type:* <a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps">EC2InstanceRunningScheduleStackProps</a>
|
|
193
211
|
|
|
194
|
-
Target resource, schedules, secrets, and standard stack props.
|
|
212
|
+
Target resource, schedules, secrets, optional failure detection, and standard stack props.
|
|
195
213
|
|
|
196
214
|
---
|
|
197
215
|
|
|
@@ -1108,6 +1126,222 @@ Whether termination protection is enabled for this stack.
|
|
|
1108
1126
|
---
|
|
1109
1127
|
|
|
1110
1128
|
|
|
1129
|
+
### RunningSchedulerFailureDetection <a name="RunningSchedulerFailureDetection" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection"></a>
|
|
1130
|
+
|
|
1131
|
+
CloudWatch alarms and log-based metrics for the running scheduler Lambda.
|
|
1132
|
+
|
|
1133
|
+
When enabled, creates four alarms:
|
|
1134
|
+
- `lambdaErrorsAlarm` – `AWS/Lambda` `Errors` metric.
|
|
1135
|
+
- `instanceStatusFailureAlarm` – log filter for `ResourceWaitFailed:*`.
|
|
1136
|
+
- `slackPostFailureAlarm` – log filter for `running-scheduler: Slack post failed`.
|
|
1137
|
+
- `durableExecutionFailureAlarm` – other handler-level `ERROR` logs (excluding the above).
|
|
1138
|
+
|
|
1139
|
+
Custom metrics are published under the `EC2InstanceRunningScheduler` namespace.
|
|
1140
|
+
|
|
1141
|
+
#### Initializers <a name="Initializers" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.Initializer"></a>
|
|
1142
|
+
|
|
1143
|
+
```typescript
|
|
1144
|
+
import { RunningSchedulerFailureDetection } from 'ec2-instance-running-scheduler'
|
|
1145
|
+
|
|
1146
|
+
new RunningSchedulerFailureDetection(scope: Construct, id: string, props: RunningSchedulerFailureDetectionProps)
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
| **Name** | **Type** | **Description** |
|
|
1150
|
+
| --- | --- | --- |
|
|
1151
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | - Parent construct. |
|
|
1152
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.Initializer.parameter.id">id</a></code> | <code>string</code> | - Construct id. |
|
|
1153
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.Initializer.parameter.props">props</a></code> | <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps">RunningSchedulerFailureDetectionProps</a></code> | - Lambda, log group, and {@link FailureDetectionAlarms} (must have `enabled: true`). |
|
|
1154
|
+
|
|
1155
|
+
---
|
|
1156
|
+
|
|
1157
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.Initializer.parameter.scope"></a>
|
|
1158
|
+
|
|
1159
|
+
- *Type:* constructs.Construct
|
|
1160
|
+
|
|
1161
|
+
Parent construct.
|
|
1162
|
+
|
|
1163
|
+
---
|
|
1164
|
+
|
|
1165
|
+
##### `id`<sup>Required</sup> <a name="id" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.Initializer.parameter.id"></a>
|
|
1166
|
+
|
|
1167
|
+
- *Type:* string
|
|
1168
|
+
|
|
1169
|
+
Construct id.
|
|
1170
|
+
|
|
1171
|
+
---
|
|
1172
|
+
|
|
1173
|
+
##### `props`<sup>Required</sup> <a name="props" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.Initializer.parameter.props"></a>
|
|
1174
|
+
|
|
1175
|
+
- *Type:* <a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps">RunningSchedulerFailureDetectionProps</a>
|
|
1176
|
+
|
|
1177
|
+
Lambda, log group, and {@link FailureDetectionAlarms} (must have `enabled: true`).
|
|
1178
|
+
|
|
1179
|
+
---
|
|
1180
|
+
|
|
1181
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
1182
|
+
|
|
1183
|
+
| **Name** | **Description** |
|
|
1184
|
+
| --- | --- |
|
|
1185
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
1186
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
1187
|
+
|
|
1188
|
+
---
|
|
1189
|
+
|
|
1190
|
+
##### `toString` <a name="toString" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.toString"></a>
|
|
1191
|
+
|
|
1192
|
+
```typescript
|
|
1193
|
+
public toString(): string
|
|
1194
|
+
```
|
|
1195
|
+
|
|
1196
|
+
Returns a string representation of this construct.
|
|
1197
|
+
|
|
1198
|
+
##### `with` <a name="with" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.with"></a>
|
|
1199
|
+
|
|
1200
|
+
```typescript
|
|
1201
|
+
public with(mixins: ...IMixin[]): IConstruct
|
|
1202
|
+
```
|
|
1203
|
+
|
|
1204
|
+
Applies one or more mixins to this construct.
|
|
1205
|
+
|
|
1206
|
+
Mixins are applied in order. The list of constructs is captured at the
|
|
1207
|
+
start of the call, so constructs added by a mixin will not be visited.
|
|
1208
|
+
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
1209
|
+
constructs.
|
|
1210
|
+
|
|
1211
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.with.parameter.mixins"></a>
|
|
1212
|
+
|
|
1213
|
+
- *Type:* ...constructs.IMixin[]
|
|
1214
|
+
|
|
1215
|
+
The mixins to apply.
|
|
1216
|
+
|
|
1217
|
+
---
|
|
1218
|
+
|
|
1219
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
1220
|
+
|
|
1221
|
+
| **Name** | **Description** |
|
|
1222
|
+
| --- | --- |
|
|
1223
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
1224
|
+
|
|
1225
|
+
---
|
|
1226
|
+
|
|
1227
|
+
##### `isConstruct` <a name="isConstruct" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.isConstruct"></a>
|
|
1228
|
+
|
|
1229
|
+
```typescript
|
|
1230
|
+
import { RunningSchedulerFailureDetection } from 'ec2-instance-running-scheduler'
|
|
1231
|
+
|
|
1232
|
+
RunningSchedulerFailureDetection.isConstruct(x: any)
|
|
1233
|
+
```
|
|
1234
|
+
|
|
1235
|
+
Checks if `x` is a construct.
|
|
1236
|
+
|
|
1237
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
1238
|
+
instances, even when the construct library is symlinked.
|
|
1239
|
+
|
|
1240
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
1241
|
+
disk are seen as independent, completely different libraries. As a
|
|
1242
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
1243
|
+
is seen as a different class, and an instance of one class will not test as
|
|
1244
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
1245
|
+
like this, but users may manually symlink construct libraries together or
|
|
1246
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
1247
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
1248
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
1249
|
+
this type-testing method instead.
|
|
1250
|
+
|
|
1251
|
+
###### `x`<sup>Required</sup> <a name="x" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.isConstruct.parameter.x"></a>
|
|
1252
|
+
|
|
1253
|
+
- *Type:* any
|
|
1254
|
+
|
|
1255
|
+
Any object.
|
|
1256
|
+
|
|
1257
|
+
---
|
|
1258
|
+
|
|
1259
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1260
|
+
|
|
1261
|
+
| **Name** | **Type** | **Description** |
|
|
1262
|
+
| --- | --- | --- |
|
|
1263
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
1264
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.durableExecutionFailureAlarm">durableExecutionFailureAlarm</a></code> | <code>aws-cdk-lib.aws_cloudwatch.Alarm</code> | Fires on handler-level ERROR logs outside instance waiting and Slack post failures. |
|
|
1265
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.instanceStatusFailureAlarm">instanceStatusFailureAlarm</a></code> | <code>aws-cdk-lib.aws_cloudwatch.Alarm</code> | Fires when instance stable-state waiting fails (`ResourceWaitFailed:*`). |
|
|
1266
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.lambdaErrorsAlarm">lambdaErrorsAlarm</a></code> | <code>aws-cdk-lib.aws_cloudwatch.Alarm</code> | Fires when the Lambda `Errors` metric is non-zero. |
|
|
1267
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.slackPostFailureAlarm">slackPostFailureAlarm</a></code> | <code>aws-cdk-lib.aws_cloudwatch.Alarm</code> | Fires when Slack `chat.postMessage` fails. |
|
|
1268
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.alarmTopic">alarmTopic</a></code> | <code>aws-cdk-lib.aws_sns.ITopic</code> | SNS topic used for alarm actions, when configured. |
|
|
1269
|
+
|
|
1270
|
+
---
|
|
1271
|
+
|
|
1272
|
+
##### `node`<sup>Required</sup> <a name="node" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.node"></a>
|
|
1273
|
+
|
|
1274
|
+
```typescript
|
|
1275
|
+
public readonly node: Node;
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
- *Type:* constructs.Node
|
|
1279
|
+
|
|
1280
|
+
The tree node.
|
|
1281
|
+
|
|
1282
|
+
---
|
|
1283
|
+
|
|
1284
|
+
##### `durableExecutionFailureAlarm`<sup>Required</sup> <a name="durableExecutionFailureAlarm" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.durableExecutionFailureAlarm"></a>
|
|
1285
|
+
|
|
1286
|
+
```typescript
|
|
1287
|
+
public readonly durableExecutionFailureAlarm: Alarm;
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.Alarm
|
|
1291
|
+
|
|
1292
|
+
Fires on handler-level ERROR logs outside instance waiting and Slack post failures.
|
|
1293
|
+
|
|
1294
|
+
---
|
|
1295
|
+
|
|
1296
|
+
##### `instanceStatusFailureAlarm`<sup>Required</sup> <a name="instanceStatusFailureAlarm" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.instanceStatusFailureAlarm"></a>
|
|
1297
|
+
|
|
1298
|
+
```typescript
|
|
1299
|
+
public readonly instanceStatusFailureAlarm: Alarm;
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.Alarm
|
|
1303
|
+
|
|
1304
|
+
Fires when instance stable-state waiting fails (`ResourceWaitFailed:*`).
|
|
1305
|
+
|
|
1306
|
+
---
|
|
1307
|
+
|
|
1308
|
+
##### `lambdaErrorsAlarm`<sup>Required</sup> <a name="lambdaErrorsAlarm" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.lambdaErrorsAlarm"></a>
|
|
1309
|
+
|
|
1310
|
+
```typescript
|
|
1311
|
+
public readonly lambdaErrorsAlarm: Alarm;
|
|
1312
|
+
```
|
|
1313
|
+
|
|
1314
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.Alarm
|
|
1315
|
+
|
|
1316
|
+
Fires when the Lambda `Errors` metric is non-zero.
|
|
1317
|
+
|
|
1318
|
+
---
|
|
1319
|
+
|
|
1320
|
+
##### `slackPostFailureAlarm`<sup>Required</sup> <a name="slackPostFailureAlarm" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.slackPostFailureAlarm"></a>
|
|
1321
|
+
|
|
1322
|
+
```typescript
|
|
1323
|
+
public readonly slackPostFailureAlarm: Alarm;
|
|
1324
|
+
```
|
|
1325
|
+
|
|
1326
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.Alarm
|
|
1327
|
+
|
|
1328
|
+
Fires when Slack `chat.postMessage` fails.
|
|
1329
|
+
|
|
1330
|
+
---
|
|
1331
|
+
|
|
1332
|
+
##### `alarmTopic`<sup>Optional</sup> <a name="alarmTopic" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetection.property.alarmTopic"></a>
|
|
1333
|
+
|
|
1334
|
+
```typescript
|
|
1335
|
+
public readonly alarmTopic: ITopic;
|
|
1336
|
+
```
|
|
1337
|
+
|
|
1338
|
+
- *Type:* aws-cdk-lib.aws_sns.ITopic
|
|
1339
|
+
|
|
1340
|
+
SNS topic used for alarm actions, when configured.
|
|
1341
|
+
|
|
1342
|
+
---
|
|
1343
|
+
|
|
1344
|
+
|
|
1111
1345
|
## Structs <a name="Structs" id="Structs"></a>
|
|
1112
1346
|
|
|
1113
1347
|
### EC2InstanceRunningSchedulerProps <a name="EC2InstanceRunningSchedulerProps" id="ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps"></a>
|
|
@@ -1129,7 +1363,8 @@ const eC2InstanceRunningSchedulerProps: EC2InstanceRunningSchedulerProps = { ...
|
|
|
1129
1363
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.secrets">secrets</a></code> | <code><a href="#ec2-instance-running-scheduler.Secrets">Secrets</a></code> | Secrets (e.g. Slack) used for notifications. |
|
|
1130
1364
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.targetResource">targetResource</a></code> | <code><a href="#ec2-instance-running-scheduler.TargetResource">TargetResource</a></code> | Tag-based targeting for EC2 instances to start/stop. |
|
|
1131
1365
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.enableScheduling">enableScheduling</a></code> | <code>boolean</code> | Whether EventBridge Scheduler rules are enabled. |
|
|
1132
|
-
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.
|
|
1366
|
+
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.failureDetection">failureDetection</a></code> | <code><a href="#ec2-instance-running-scheduler.FailureDetectionAlarms">FailureDetectionAlarms</a></code> | Optional CloudWatch alarms and log-based metrics for failure detection. |
|
|
1367
|
+
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.resourceWait">resourceWait</a></code> | <code><a href="#ec2-instance-running-scheduler.ResourceWaitLimits">ResourceWaitLimits</a></code> | Per-instance wait limits for the running scheduler Lambda. |
|
|
1133
1368
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.startSchedule">startSchedule</a></code> | <code><a href="#ec2-instance-running-scheduler.Schedule">Schedule</a></code> | Cron schedule for starting instances. |
|
|
1134
1369
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.stopSchedule">stopSchedule</a></code> | <code><a href="#ec2-instance-running-scheduler.Schedule">Schedule</a></code> | Cron schedule for stopping instances. |
|
|
1135
1370
|
|
|
@@ -1173,16 +1408,31 @@ Defaults to true if omitted.
|
|
|
1173
1408
|
|
|
1174
1409
|
---
|
|
1175
1410
|
|
|
1176
|
-
##### `
|
|
1411
|
+
##### `failureDetection`<sup>Optional</sup> <a name="failureDetection" id="ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.failureDetection"></a>
|
|
1412
|
+
|
|
1413
|
+
```typescript
|
|
1414
|
+
public readonly failureDetection: FailureDetectionAlarms;
|
|
1415
|
+
```
|
|
1416
|
+
|
|
1417
|
+
- *Type:* <a href="#ec2-instance-running-scheduler.FailureDetectionAlarms">FailureDetectionAlarms</a>
|
|
1418
|
+
- *Default:* disabled when omitted
|
|
1419
|
+
|
|
1420
|
+
Optional CloudWatch alarms and log-based metrics for failure detection.
|
|
1421
|
+
|
|
1422
|
+
Set `enabled: true` to create alarms; optionally pass `alarmTopic` for SNS notifications.
|
|
1423
|
+
|
|
1424
|
+
---
|
|
1425
|
+
|
|
1426
|
+
##### `resourceWait`<sup>Optional</sup> <a name="resourceWait" id="ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.resourceWait"></a>
|
|
1177
1427
|
|
|
1178
1428
|
```typescript
|
|
1179
|
-
public readonly
|
|
1429
|
+
public readonly resourceWait: ResourceWaitLimits;
|
|
1180
1430
|
```
|
|
1181
1431
|
|
|
1182
|
-
- *Type:* <a href="#ec2-instance-running-scheduler.
|
|
1183
|
-
- *Default:* {@link
|
|
1432
|
+
- *Type:* <a href="#ec2-instance-running-scheduler.ResourceWaitLimits">ResourceWaitLimits</a>
|
|
1433
|
+
- *Default:* {@link DEFAULT_RESOURCE_WAIT_LIMITS }
|
|
1184
1434
|
|
|
1185
|
-
Per-instance
|
|
1435
|
+
Per-instance wait limits for the running scheduler Lambda.
|
|
1186
1436
|
|
|
1187
1437
|
---
|
|
1188
1438
|
|
|
@@ -1214,7 +1464,7 @@ Cron schedule for stopping instances.
|
|
|
1214
1464
|
|
|
1215
1465
|
Props for the EC2 instance running schedule CDK stack.
|
|
1216
1466
|
|
|
1217
|
-
> [{@link EC2InstanceRunningSchedulerProps } for construct-level options not exposed here (e.g. `
|
|
1467
|
+
> [{@link EC2InstanceRunningSchedulerProps } for construct-level options not exposed here (e.g. `resourceWait`).]({@link EC2InstanceRunningSchedulerProps } for construct-level options not exposed here (e.g. `resourceWait`).)
|
|
1218
1468
|
|
|
1219
1469
|
#### Initializer <a name="Initializer" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.Initializer"></a>
|
|
1220
1470
|
|
|
@@ -1243,6 +1493,7 @@ const eC2InstanceRunningScheduleStackProps: EC2InstanceRunningScheduleStackProps
|
|
|
1243
1493
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.property.secrets">secrets</a></code> | <code><a href="#ec2-instance-running-scheduler.Secrets">Secrets</a></code> | Secrets (e.g. Slack) for the scheduler. |
|
|
1244
1494
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.property.targetResource">targetResource</a></code> | <code><a href="#ec2-instance-running-scheduler.TargetResource">TargetResource</a></code> | Tag-based target resource for EC2 instances to start/stop. |
|
|
1245
1495
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.property.enableScheduling">enableScheduling</a></code> | <code>boolean</code> | Whether scheduling is enabled. |
|
|
1496
|
+
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.property.failureDetection">failureDetection</a></code> | <code><a href="#ec2-instance-running-scheduler.FailureDetectionAlarms">FailureDetectionAlarms</a></code> | Optional CloudWatch failure detection alarms and log-based metrics. |
|
|
1246
1497
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.property.startSchedule">startSchedule</a></code> | <code><a href="#ec2-instance-running-scheduler.Schedule">Schedule</a></code> | Cron schedule for starting instances. |
|
|
1247
1498
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.property.stopSchedule">stopSchedule</a></code> | <code><a href="#ec2-instance-running-scheduler.Schedule">Schedule</a></code> | Cron schedule for stopping instances. |
|
|
1248
1499
|
|
|
@@ -1530,6 +1781,18 @@ Defaults to true if omitted.
|
|
|
1530
1781
|
|
|
1531
1782
|
---
|
|
1532
1783
|
|
|
1784
|
+
##### `failureDetection`<sup>Optional</sup> <a name="failureDetection" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.property.failureDetection"></a>
|
|
1785
|
+
|
|
1786
|
+
```typescript
|
|
1787
|
+
public readonly failureDetection: FailureDetectionAlarms;
|
|
1788
|
+
```
|
|
1789
|
+
|
|
1790
|
+
- *Type:* <a href="#ec2-instance-running-scheduler.FailureDetectionAlarms">FailureDetectionAlarms</a>
|
|
1791
|
+
|
|
1792
|
+
Optional CloudWatch failure detection alarms and log-based metrics.
|
|
1793
|
+
|
|
1794
|
+
---
|
|
1795
|
+
|
|
1533
1796
|
##### `startSchedule`<sup>Optional</sup> <a name="startSchedule" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.property.startSchedule"></a>
|
|
1534
1797
|
|
|
1535
1798
|
```typescript
|
|
@@ -1554,54 +1817,166 @@ Cron schedule for stopping instances.
|
|
|
1554
1817
|
|
|
1555
1818
|
---
|
|
1556
1819
|
|
|
1557
|
-
###
|
|
1820
|
+
### FailureDetectionAlarms <a name="FailureDetectionAlarms" id="ec2-instance-running-scheduler.FailureDetectionAlarms"></a>
|
|
1558
1821
|
|
|
1559
|
-
|
|
1822
|
+
Optional CloudWatch alarms and log-based metrics for operational failure detection.
|
|
1823
|
+
|
|
1824
|
+
When {@link FailureDetectionAlarms.enabled} is true, the construct creates alarms for Lambda
|
|
1825
|
+
errors, Durable handler failures, EC2 instance status wait failures, and Slack post failures.
|
|
1826
|
+
Alarms can optionally notify an SNS topic supplied by the caller.
|
|
1827
|
+
|
|
1828
|
+
#### Initializer <a name="Initializer" id="ec2-instance-running-scheduler.FailureDetectionAlarms.Initializer"></a>
|
|
1829
|
+
|
|
1830
|
+
```typescript
|
|
1831
|
+
import { FailureDetectionAlarms } from 'ec2-instance-running-scheduler'
|
|
1832
|
+
|
|
1833
|
+
const failureDetectionAlarms: FailureDetectionAlarms = { ... }
|
|
1834
|
+
```
|
|
1835
|
+
|
|
1836
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1560
1837
|
|
|
1561
|
-
|
|
1838
|
+
| **Name** | **Type** | **Description** |
|
|
1839
|
+
| --- | --- | --- |
|
|
1840
|
+
| <code><a href="#ec2-instance-running-scheduler.FailureDetectionAlarms.property.alarmTopic">alarmTopic</a></code> | <code>aws-cdk-lib.aws_sns.ITopic</code> | SNS topic for alarm notifications. |
|
|
1841
|
+
| <code><a href="#ec2-instance-running-scheduler.FailureDetectionAlarms.property.enabled">enabled</a></code> | <code>boolean</code> | When true, creates failure detection alarms and log-based metrics. |
|
|
1842
|
+
|
|
1843
|
+
---
|
|
1844
|
+
|
|
1845
|
+
##### `alarmTopic`<sup>Optional</sup> <a name="alarmTopic" id="ec2-instance-running-scheduler.FailureDetectionAlarms.property.alarmTopic"></a>
|
|
1846
|
+
|
|
1847
|
+
```typescript
|
|
1848
|
+
public readonly alarmTopic: ITopic;
|
|
1849
|
+
```
|
|
1850
|
+
|
|
1851
|
+
- *Type:* aws-cdk-lib.aws_sns.ITopic
|
|
1852
|
+
|
|
1853
|
+
SNS topic for alarm notifications.
|
|
1854
|
+
|
|
1855
|
+
When omitted, alarms are created without SNS actions.
|
|
1856
|
+
|
|
1857
|
+
---
|
|
1858
|
+
|
|
1859
|
+
##### `enabled`<sup>Optional</sup> <a name="enabled" id="ec2-instance-running-scheduler.FailureDetectionAlarms.property.enabled"></a>
|
|
1860
|
+
|
|
1861
|
+
```typescript
|
|
1862
|
+
public readonly enabled: boolean;
|
|
1863
|
+
```
|
|
1864
|
+
|
|
1865
|
+
- *Type:* boolean
|
|
1866
|
+
- *Default:* false when omitted
|
|
1867
|
+
|
|
1868
|
+
When true, creates failure detection alarms and log-based metrics.
|
|
1869
|
+
|
|
1870
|
+
---
|
|
1871
|
+
|
|
1872
|
+
### ResourceWaitLimits <a name="ResourceWaitLimits" id="ec2-instance-running-scheduler.ResourceWaitLimits"></a>
|
|
1873
|
+
|
|
1874
|
+
CDK-side limits for per-instance stable-state waiting in the Durable Lambda handler.
|
|
1875
|
+
|
|
1876
|
+
Optional fields map to {@link PROCESS_RESOURCE_MAX_LOOP_COUNT_ENV} and
|
|
1562
1877
|
{@link PROCESS_RESOURCE_MAX_ELAPSED_SECONDS_ENV} on the running scheduler function.
|
|
1563
1878
|
Prevents abnormal or stuck transitions from running until the Durable execution timeout.
|
|
1564
1879
|
|
|
1565
|
-
|
|
1880
|
+
> [{@link ResourceWaitLimits } in `running-scheduler-predicates.ts` for the handler-side required shape.]({@link ResourceWaitLimits } in `running-scheduler-predicates.ts` for the handler-side required shape.)
|
|
1881
|
+
|
|
1882
|
+
#### Initializer <a name="Initializer" id="ec2-instance-running-scheduler.ResourceWaitLimits.Initializer"></a>
|
|
1566
1883
|
|
|
1567
1884
|
```typescript
|
|
1568
|
-
import {
|
|
1885
|
+
import { ResourceWaitLimits } from 'ec2-instance-running-scheduler'
|
|
1569
1886
|
|
|
1570
|
-
const
|
|
1887
|
+
const resourceWaitLimits: ResourceWaitLimits = { ... }
|
|
1571
1888
|
```
|
|
1572
1889
|
|
|
1573
1890
|
#### Properties <a name="Properties" id="Properties"></a>
|
|
1574
1891
|
|
|
1575
1892
|
| **Name** | **Type** | **Description** |
|
|
1576
1893
|
| --- | --- | --- |
|
|
1577
|
-
| <code><a href="#ec2-instance-running-scheduler.
|
|
1578
|
-
| <code><a href="#ec2-instance-running-scheduler.
|
|
1894
|
+
| <code><a href="#ec2-instance-running-scheduler.ResourceWaitLimits.property.maxElapsedSeconds">maxElapsedSeconds</a></code> | <code>number</code> | Maximum wall-clock seconds spent waiting for a single instance to stabilize. |
|
|
1895
|
+
| <code><a href="#ec2-instance-running-scheduler.ResourceWaitLimits.property.maxLoopCount">maxLoopCount</a></code> | <code>number</code> | Maximum describe/wait loop iterations per instance. |
|
|
1579
1896
|
|
|
1580
1897
|
---
|
|
1581
1898
|
|
|
1582
|
-
##### `maxElapsedSeconds`<sup>Optional</sup> <a name="maxElapsedSeconds" id="ec2-instance-running-scheduler.
|
|
1899
|
+
##### `maxElapsedSeconds`<sup>Optional</sup> <a name="maxElapsedSeconds" id="ec2-instance-running-scheduler.ResourceWaitLimits.property.maxElapsedSeconds"></a>
|
|
1583
1900
|
|
|
1584
1901
|
```typescript
|
|
1585
1902
|
public readonly maxElapsedSeconds: number;
|
|
1586
1903
|
```
|
|
1587
1904
|
|
|
1588
1905
|
- *Type:* number
|
|
1589
|
-
- *Default:* {@link
|
|
1906
|
+
- *Default:* {@link DEFAULT_RESOURCE_WAIT_LIMITS.maxElapsedSeconds } (1800, 30 minutes)
|
|
1590
1907
|
|
|
1591
|
-
Maximum wall-clock seconds spent
|
|
1908
|
+
Maximum wall-clock seconds spent waiting for a single instance to stabilize.
|
|
1592
1909
|
|
|
1593
1910
|
---
|
|
1594
1911
|
|
|
1595
|
-
##### `maxLoopCount`<sup>Optional</sup> <a name="maxLoopCount" id="ec2-instance-running-scheduler.
|
|
1912
|
+
##### `maxLoopCount`<sup>Optional</sup> <a name="maxLoopCount" id="ec2-instance-running-scheduler.ResourceWaitLimits.property.maxLoopCount"></a>
|
|
1596
1913
|
|
|
1597
1914
|
```typescript
|
|
1598
1915
|
public readonly maxLoopCount: number;
|
|
1599
1916
|
```
|
|
1600
1917
|
|
|
1601
1918
|
- *Type:* number
|
|
1602
|
-
- *Default:* {@link
|
|
1919
|
+
- *Default:* {@link DEFAULT_RESOURCE_WAIT_LIMITS.maxLoopCount } (90)
|
|
1920
|
+
|
|
1921
|
+
Maximum describe/wait loop iterations per instance.
|
|
1922
|
+
|
|
1923
|
+
---
|
|
1924
|
+
|
|
1925
|
+
### RunningSchedulerFailureDetectionProps <a name="RunningSchedulerFailureDetectionProps" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps"></a>
|
|
1926
|
+
|
|
1927
|
+
Props for {@link RunningSchedulerFailureDetection}.
|
|
1928
|
+
|
|
1929
|
+
#### Initializer <a name="Initializer" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps.Initializer"></a>
|
|
1930
|
+
|
|
1931
|
+
```typescript
|
|
1932
|
+
import { RunningSchedulerFailureDetectionProps } from 'ec2-instance-running-scheduler'
|
|
1933
|
+
|
|
1934
|
+
const runningSchedulerFailureDetectionProps: RunningSchedulerFailureDetectionProps = { ... }
|
|
1935
|
+
```
|
|
1936
|
+
|
|
1937
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1938
|
+
|
|
1939
|
+
| **Name** | **Type** | **Description** |
|
|
1940
|
+
| --- | --- | --- |
|
|
1941
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps.property.failureDetection">failureDetection</a></code> | <code><a href="#ec2-instance-running-scheduler.FailureDetectionAlarms">FailureDetectionAlarms</a></code> | Alarm configuration (must have {@link FailureDetectionAlarms.enabled} true). |
|
|
1942
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps.property.logGroup">logGroup</a></code> | <code>aws-cdk-lib.aws_logs.ILogGroup</code> | Application log group for the running scheduler Lambda. |
|
|
1943
|
+
| <code><a href="#ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps.property.runningScheduleFunction">runningScheduleFunction</a></code> | <code>aws-cdk-lib.aws_lambda.IFunction</code> | Running scheduler Lambda to monitor. |
|
|
1944
|
+
|
|
1945
|
+
---
|
|
1946
|
+
|
|
1947
|
+
##### `failureDetection`<sup>Required</sup> <a name="failureDetection" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps.property.failureDetection"></a>
|
|
1948
|
+
|
|
1949
|
+
```typescript
|
|
1950
|
+
public readonly failureDetection: FailureDetectionAlarms;
|
|
1951
|
+
```
|
|
1952
|
+
|
|
1953
|
+
- *Type:* <a href="#ec2-instance-running-scheduler.FailureDetectionAlarms">FailureDetectionAlarms</a>
|
|
1954
|
+
|
|
1955
|
+
Alarm configuration (must have {@link FailureDetectionAlarms.enabled} true).
|
|
1956
|
+
|
|
1957
|
+
---
|
|
1958
|
+
|
|
1959
|
+
##### `logGroup`<sup>Required</sup> <a name="logGroup" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps.property.logGroup"></a>
|
|
1960
|
+
|
|
1961
|
+
```typescript
|
|
1962
|
+
public readonly logGroup: ILogGroup;
|
|
1963
|
+
```
|
|
1964
|
+
|
|
1965
|
+
- *Type:* aws-cdk-lib.aws_logs.ILogGroup
|
|
1966
|
+
|
|
1967
|
+
Application log group for the running scheduler Lambda.
|
|
1968
|
+
|
|
1969
|
+
---
|
|
1970
|
+
|
|
1971
|
+
##### `runningScheduleFunction`<sup>Required</sup> <a name="runningScheduleFunction" id="ec2-instance-running-scheduler.RunningSchedulerFailureDetectionProps.property.runningScheduleFunction"></a>
|
|
1972
|
+
|
|
1973
|
+
```typescript
|
|
1974
|
+
public readonly runningScheduleFunction: IFunction;
|
|
1975
|
+
```
|
|
1976
|
+
|
|
1977
|
+
- *Type:* aws-cdk-lib.aws_lambda.IFunction
|
|
1603
1978
|
|
|
1604
|
-
|
|
1979
|
+
Running scheduler Lambda to monitor.
|
|
1605
1980
|
|
|
1606
1981
|
---
|
|
1607
1982
|
|