ec2-instance-running-scheduler 0.1.8 → 0.2.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 +110 -36
- package/API.md +77 -7
- package/README.md +39 -12
- package/assets/funcs/running-scheduler.lambda/index.js +144 -38
- package/assets/funcs/running-scheduler.lambda/index.js.map +4 -4
- package/lib/constructs/ec2-instance-running-scheduler.d.ts +31 -1
- package/lib/constructs/ec2-instance-running-scheduler.js +10 -3
- package/lib/funcs/running-scheduler-polling-config.d.ts +17 -0
- package/lib/funcs/running-scheduler-polling-config.js +21 -0
- package/lib/funcs/running-scheduler-polling-env.d.ts +8 -0
- package/lib/funcs/running-scheduler-polling-env.js +53 -0
- package/lib/funcs/running-scheduler-predicates.d.ts +56 -0
- package/lib/funcs/running-scheduler-predicates.js +55 -2
- package/lib/funcs/running-scheduler.lambda.d.ts +12 -3
- package/lib/funcs/running-scheduler.lambda.js +53 -11
- package/lib/index.d.ts +3 -1
- package/lib/index.js +4 -2
- package/lib/stacks/ec2-instance-running-schedule-stack.d.ts +6 -4
- package/lib/stacks/ec2-instance-running-schedule-stack.js +6 -6
- package/package.json +3 -3
package/.jsii
CHANGED
|
@@ -8440,7 +8440,7 @@
|
|
|
8440
8440
|
"stability": "stable"
|
|
8441
8441
|
},
|
|
8442
8442
|
"homepage": "https://github.com/gammarers-aws-cdk-constructs/ec2-instance-running-scheduler.git",
|
|
8443
|
-
"jsiiVersion": "5.9.
|
|
8443
|
+
"jsiiVersion": "5.9.44 (build 150b837)",
|
|
8444
8444
|
"keywords": [
|
|
8445
8445
|
"cdk"
|
|
8446
8446
|
],
|
|
@@ -8455,7 +8455,7 @@
|
|
|
8455
8455
|
},
|
|
8456
8456
|
"name": "ec2-instance-running-scheduler",
|
|
8457
8457
|
"readme": {
|
|
8458
|
-
"markdown": "# EC2 Instance Running Scheduler (AWS CDK v2)\n\n[](https://github.com/gammarers-aws-cdk-constructs/ec2-instance-running-scheduler/blob/main/LICENSE)\n[](https://www.npmjs.com/package/ec2-instance-running-scheduler)\n[](https://github.com/gammarers-aws-cdk-constructs/ec2-instance-running-scheduler/actions/workflows/release.yml)\n[](https://github.com/gammarers-aws-cdk-constructs/ec2-instance-running-scheduler/releases)\n\n[](https://constructs.dev/packages/ec2-instance-running-scheduler)\n\nAWS CDK construct that starts and stops EC2 instances on a cron schedule using **EventBridge Scheduler** and a **Durable Execution Lambda**. The handler discovers instances with the **Resource Groups Tagging API**, runs start/stop and **polls until the instance reaches the target state** (durable `step` / `wait`), processes **multiple instances in parallel** (bounded concurrency), and posts **Slack** summary and per-instance thread messages using a secret from **Secrets Manager**. The Lambda emits **structured application logs** (invocation, EC2 transitions, Slack steps, completion) alongside JSON platform logs.\n\n## Features\n\n- **Tag-based targeting** – Select EC2 instances by tag key and values (e.g. `Schedule` / `YES`) via `tag:GetResources`.\n- **EventBridge Scheduler** – Separate cron rules for start and stop, with per-rule timezone (`aws-cdk-lib` `TimeZone`).\n- **Durable Lambda** – One Lambda with AWS Lambda Durable Execution (`step`, `wait`, `map`, child contexts per instance) for long-running workflows without Step Functions.\n- **Stable-state polling** – After start/stop, the function waits and re-describes instances until `running` (start mode) or `stopped` (stop mode), or until a terminal error.\n- **Slack notifications** – Required for a successful run: parent message plus threaded updates per instance; credentials come from Secrets Manager (`token` and `channel` JSON). The secret name is passed as **`SLACK_SECRET_NAME`** on the function (from `secrets.slackSecretName`) and validated at runtime via **safe-env-getter**.\n- **Structured logging** – The handler uses the durable execution **`ctx.logger`** for traceable JSON application logs (e.g. invocation, describe/start/stop/wait loops, target count, Slack posts, errors before instance state failures).\n- **Scheduling toggle** – Enable or disable both schedules without removing the stack (`enableScheduling`).\n- **Configurable schedules** – Optional cron overrides for start and stop (`minute`, `hour`, `week`, `timezone`); sensible defaults if omitted.\n- **IAM and observability** – EC2 and tagging API permissions, Slack secret read grant, **Parameters and Secrets Lambda Extension** (configured on the function for secret access patterns), JSON logging with configurable system/application levels, and a dedicated log group (construct defaults).\n\n## Installation\n\n**npm**\n\n```bash\nnpm install ec2-instance-running-scheduler\n```\n\n**yarn**\n\n```bash\nyarn add ec2-instance-running-scheduler\n```\n\n**pnpm**\n\n```bash\npnpm add ec2-instance-running-scheduler\n```\n\n## Usage\n\nUse the **construct** `EC2InstanceRunningScheduler` when embedding the scheduler in an existing stack or other CDK scope.\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { TimeZone } from 'aws-cdk-lib';\nimport { EC2InstanceRunningScheduler } from 'ec2-instance-running-scheduler';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'MyStack');\n\nnew EC2InstanceRunningScheduler(stack, 'EC2InstanceRunningScheduler', {\n targetResource: {\n tagKey: 'Schedule',\n tagValues: ['YES'],\n },\n secrets: {\n slackSecretName: 'my-slack-secret',\n },\n startSchedule: {\n timezone: TimeZone.ASIA_TOKYO,\n minute: '55',\n hour: '8',\n week: 'MON-FRI',\n },\n stopSchedule: {\n timezone: TimeZone.ASIA_TOKYO,\n minute: '5',\n hour: '19',\n week: 'MON-FRI',\n },\n enableScheduling: true,\n});\n```\n\nUse the **stack** `EC2InstanceRunningScheduleStack` when deploying the scheduler as its own stack. It accepts the **same scheduler options** as the construct (plus standard `StackProps` such as `env`).\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { TimeZone } from 'aws-cdk-lib';\nimport { EC2InstanceRunningScheduleStack } from 'ec2-instance-running-scheduler';\n\nconst app = new cdk.App();\n\nnew EC2InstanceRunningScheduleStack(app, 'EC2InstanceRunningScheduleStack', {\n targetResource: {\n tagKey: 'Schedule',\n tagValues: ['YES'],\n },\n secrets: {\n slackSecretName: 'my-slack-secret',\n },\n startSchedule: {\n timezone: TimeZone.ASIA_TOKYO,\n minute: '55',\n hour: '8',\n week: 'MON-FRI',\n },\n stopSchedule: {\n timezone: TimeZone.ASIA_TOKYO,\n minute: '5',\n hour: '19',\n week: 'MON-FRI',\n },\n enableScheduling: true,\n});\n```\n\nEventBridge Scheduler invokes the Lambda with `Params.TagKey`, `Params.TagValues`, and `Params.Mode` (`Start` or `Stop`); the construct wires this for you. The function environment includes **`SLACK_SECRET_NAME`** set to `secrets.slackSecretName`.\n\n## Options\n\nThese options apply to **`EC2InstanceRunningScheduler`** and to **`EC2InstanceRunningScheduleStack`** (stack props include them alongside `StackProps`).\n\n| Option | Type | Required | Description |\n|--------|------|----------|-------------|\n| `targetResource` | `TargetResource` | Yes | Tag key and values used to select EC2 instances. |\n| `secrets` | `Secrets` | Yes | Identifies the Secrets Manager secret used for Slack (`slackSecretName`). |\n| `startSchedule` | `Schedule` | No | Cron for starting instances (default: `50 7 ? * MON-FRI *` in `Etc/UTC`). |\n| `stopSchedule` | `Schedule` | No | Cron for stopping instances (default: `5 19 ? * MON-FRI *` in `Etc/UTC`). |\n| `enableScheduling` | `boolean` | No | Whether both scheduler rules are enabled (default: `true`). |\n\n### TargetResource\n\n- `tagKey` – Tag key used to select instances (e.g. `Schedule`).\n- `tagValues` – Tag values that must match (e.g. `['YES']`).\n\n### Schedule\n\n- `timezone` – `TimeZone` from `aws-cdk-lib` (e.g. `TimeZone.ASIA_TOKYO`, `TimeZone.ETC_UTC`).\n- `minute` – Cron minute (`0`–`59`).\n- `hour` – Cron hour (`0`–`23`).\n- `week` – Cron day-of-week field (e.g. `MON-FRI`).\n\n### Secrets\n\n- `slackSecretName` – Name of the AWS Secrets Manager secret. The Lambda expects JSON with **`token`** (Slack bot token) and **`channel`** (channel ID or name for `chat.postMessage`). The construct sets **`SLACK_SECRET_NAME`** on the function to this value; the handler reads and validates it at runtime (via **safe-env-getter**).\n\n## Requirements\n\n- **Node.js** ≥ 20.0.0 (for developing or synthesizing CDK apps that depend on this package).\n- **aws-cdk-lib** ^2.232.0 and **constructs** ^10.5.1 (peer dependencies).\n- **AWS** – EventBridge Scheduler; Lambda with **Durable Execution** (requires **Node.js 22+** in the deployment region—runtime is the latest Node.js available in the region per the construct), a **live alias**, **Parameters and Secrets Lambda Extension**; EC2 (describe/start/stop); Resource Groups Tagging API; Secrets Manager. The deployed function uses **arm64**, Durable Execution–compatible IAM and settings, and a bundled handler that loads secrets via **aws-lambda-secret-fetcher**.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
|
|
8458
|
+
"markdown": "# EC2 Instance Running Scheduler (AWS CDK v2)\n\n[](https://github.com/gammarers-aws-cdk-constructs/ec2-instance-running-scheduler/blob/main/LICENSE)\n[](https://www.npmjs.com/package/ec2-instance-running-scheduler)\n[](https://github.com/gammarers-aws-cdk-constructs/ec2-instance-running-scheduler/actions/workflows/release.yml)\n[](https://github.com/gammarers-aws-cdk-constructs/ec2-instance-running-scheduler/releases)\n[](https://constructs.dev/packages/ec2-instance-running-scheduler)\n\nAWS CDK construct library that starts and stops EC2 instances on a cron schedule using **EventBridge Scheduler** and a **Durable Execution Lambda**. The handler discovers instances with the **Resource Groups Tagging API**, issues start/stop, **polls until each instance reaches a stable target state** (durable `step` / `wait`), processes **multiple instances in parallel** (bounded concurrency), and posts **Slack** summary and per-instance thread messages using a secret from **Secrets Manager**. The Lambda emits **structured application logs** alongside JSON platform logs.\n\n## Features\n\n- **Tag-based targeting** – Select EC2 instances by tag key and values (e.g. `Schedule` / `YES`) via `tag:GetResources`.\n- **EventBridge Scheduler** – Separate cron rules for start and stop, with per-rule timezone (`aws-cdk-lib` `TimeZone`).\n- **Durable Lambda** – One Lambda with AWS Lambda Durable Execution (`step`, `wait`, `map`, child contexts per instance) for long-running workflows without Step Functions.\n- **Stable-state polling** – After start/stop, the function waits (20 seconds between attempts) and re-describes instances until `running` (start mode) or `stopped` (stop mode).\n- **Configurable polling limits** – Per-instance **max loop count** and **max elapsed time** via `resourcePolling` (default: 90 loops / 1800 seconds). Failures use explicit `ResourcePollingFailed:*` messages instead of running until the Durable execution timeout (construct default: 2 hours).\n- **Validated environment variables** – The bundled handler parses required and polling env vars at invocation using strict decimal integer rules; polling limits must be **positive integers** (`> 0`).\n- **Slack notifications** – Parent message plus threaded updates per instance; credentials from Secrets Manager JSON (`token`, `channel`). The construct sets **`SLACK_SECRET_NAME`** on the function.\n- **Structured logging** – Durable execution **`ctx.logger`** for traceable JSON application logs (invocation, describe/start/stop/wait loops, polling limit errors, Slack steps, completion).\n- **Scheduling toggle** – Enable or disable both schedules without removing the stack (`enableScheduling`).\n- **Configurable schedules** – Optional cron overrides for start and stop (`minute`, `hour`, `week`, `timezone`); sensible defaults if omitted.\n- **IAM and observability** – EC2 and tagging API permissions, Slack secret read grant, **Parameters and Secrets Lambda Extension**, JSON logging, and a dedicated log group (construct defaults).\n\n## Installation\n\n**npm**\n\n```bash\nnpm install ec2-instance-running-scheduler\n```\n\n**yarn**\n\n```bash\nyarn add ec2-instance-running-scheduler\n```\n\n**pnpm**\n\n```bash\npnpm add ec2-instance-running-scheduler\n```\n\n## Usage\n\nUse the **construct** `EC2InstanceRunningScheduler` when embedding the scheduler in an existing stack or other CDK scope.\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { TimeZone } from 'aws-cdk-lib';\nimport { EC2InstanceRunningScheduler } from 'ec2-instance-running-scheduler';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'MyStack');\n\nnew EC2InstanceRunningScheduler(stack, 'EC2InstanceRunningScheduler', {\n targetResource: {\n tagKey: 'Schedule',\n tagValues: ['YES'],\n },\n secrets: {\n slackSecretName: 'my-slack-secret',\n },\n startSchedule: {\n timezone: TimeZone.ASIA_TOKYO,\n minute: '55',\n hour: '8',\n week: 'MON-FRI',\n },\n stopSchedule: {\n timezone: TimeZone.ASIA_TOKYO,\n minute: '5',\n hour: '19',\n week: 'MON-FRI',\n },\n enableScheduling: true,\n resourcePolling: {\n maxLoopCount: 120,\n maxElapsedSeconds: 3600,\n },\n});\n```\n\nUse the **stack** `EC2InstanceRunningScheduleStack` when deploying the scheduler as its own stack. It accepts the same **targeting, schedules, secrets, and enable flag** as the construct (plus standard `StackProps` such as `env`). For **`resourcePolling`**, use the construct directly or extend the stack in your app.\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { TimeZone } from 'aws-cdk-lib';\nimport { EC2InstanceRunningScheduleStack } from 'ec2-instance-running-scheduler';\n\nconst app = new cdk.App();\n\nnew EC2InstanceRunningScheduleStack(app, 'EC2InstanceRunningScheduleStack', {\n targetResource: {\n tagKey: 'Schedule',\n tagValues: ['YES'],\n },\n secrets: {\n slackSecretName: 'my-slack-secret',\n },\n startSchedule: {\n timezone: TimeZone.ASIA_TOKYO,\n minute: '55',\n hour: '8',\n week: 'MON-FRI',\n },\n stopSchedule: {\n timezone: TimeZone.ASIA_TOKYO,\n minute: '5',\n hour: '19',\n week: 'MON-FRI',\n },\n enableScheduling: true,\n});\n```\n\nEventBridge Scheduler invokes the Lambda with `Params.TagKey`, `Params.TagValues`, and `Params.Mode` (`Start` or `Stop`); the construct wires this for you. The function environment includes:\n\n| Variable | Source | Purpose |\n|----------|--------|---------|\n| `SLACK_SECRET_NAME` | `secrets.slackSecretName` | Secrets Manager secret for Slack (required) |\n| `PROCESS_RESOURCE_MAX_LOOP_COUNT` | `resourcePolling.maxLoopCount` (default `90`) | Max describe/poll iterations per instance |\n| `PROCESS_RESOURCE_MAX_ELAPSED_SECONDS` | `resourcePolling.maxElapsedSeconds` (default `1800`) | Max wall-clock seconds polling one instance |\n\nWhen you set polling limits via `resourcePolling`, the construct writes them as decimal integer strings. If you override these variables manually, each value must be a **strict decimal integer** (e.g. `\"120\"` is valid; `\"0x10\"`, `\"3.14\"`, or `\"10abc\"` are rejected) and **greater than zero**. Invalid or missing `SLACK_SECRET_NAME` causes the handler to fail at the start of an invocation.\n\n## Options\n\n### EC2InstanceRunningScheduler\n\n| Option | Type | Required | Description |\n|--------|------|----------|-------------|\n| `targetResource` | `TargetResource` | Yes | Tag key and values used to select EC2 instances. |\n| `secrets` | `Secrets` | Yes | Secrets Manager secret for Slack (`slackSecretName`). |\n| `startSchedule` | `Schedule` | No | Cron for starting instances (default: `50 7 ? * MON-FRI *` in `Etc/UTC`). |\n| `stopSchedule` | `Schedule` | No | Cron for stopping instances (default: `5 19 ? * MON-FRI *` in `Etc/UTC`). |\n| `enableScheduling` | `boolean` | No | Whether both scheduler rules are enabled (default: `true`). |\n| `resourcePolling` | `ResourcePollingLimits` | No | Per-instance polling caps (see below). |\n\n### EC2InstanceRunningScheduleStack\n\nIncludes `targetResource`, `secrets`, `startSchedule`, `stopSchedule`, `enableScheduling`, and standard `StackProps`. Does **not** expose `resourcePolling`; use `EC2InstanceRunningScheduler` when you need custom polling limits.\n\n### TargetResource\n\n- `tagKey` – Tag key used to select instances (e.g. `Schedule`).\n- `tagValues` – Tag values that must match (e.g. `['YES']`).\n\n### Schedule\n\n- `timezone` – `TimeZone` from `aws-cdk-lib` (e.g. `TimeZone.ASIA_TOKYO`, `TimeZone.ETC_UTC`).\n- `minute` – Cron minute (`0`–`59`).\n- `hour` – Cron hour (`0`–`23`).\n- `week` – Cron day-of-week field (e.g. `MON-FRI`).\n\n### Secrets\n\n- `slackSecretName` – Name of the AWS Secrets Manager secret. The Lambda expects JSON with **`token`** (Slack bot token) and **`channel`** (channel ID or name for `chat.postMessage`).\n\n### ResourcePollingLimits\n\nWritten to `PROCESS_RESOURCE_MAX_LOOP_COUNT` and `PROCESS_RESOURCE_MAX_ELAPSED_SECONDS` on the running scheduler Lambda.\n\n- `maxLoopCount` – Maximum describe/poll loop iterations per instance (default: **90**). Must be a positive integer when set.\n- `maxElapsedSeconds` – Maximum wall-clock seconds spent polling one instance (default: **1800**, 30 minutes). Must be a positive integer when set.\n\nWhen a limit is exceeded during polling, the handler throws an error with prefix `ResourcePollingFailed:` (`MaxLoopCountExceeded`, `MaxElapsedTimeExceeded`, or `UnexpectedInstanceState` for unknown EC2 states).\n\n## Requirements\n\n- **Node.js** ≥ 20.0.0 (for developing or synthesizing CDK apps that depend on this package).\n- **aws-cdk-lib** ^2.232.0 and **constructs** ^10.5.1 (peer dependencies).\n- **AWS** – EventBridge Scheduler; Lambda with **Durable Execution** (Node.js **24.x** runtime in the construct; Durable Execution requires a supported Node.js runtime in your region), a **live alias**, **Parameters and Secrets Lambda Extension**; EC2 (`DescribeInstances`, `StartInstances`, `StopInstances`); Resource Groups Tagging API (`tag:GetResources`); Secrets Manager. The deployed function uses **arm64**, Durable Execution IAM policies, a 2-hour Durable execution timeout (construct default), and a bundled handler that loads secrets via **aws-lambda-secret-fetcher**.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
|
|
8459
8459
|
},
|
|
8460
8460
|
"repository": {
|
|
8461
8461
|
"type": "git",
|
|
@@ -8473,22 +8473,22 @@
|
|
|
8473
8473
|
"base": "aws-cdk-lib.Stack",
|
|
8474
8474
|
"docs": {
|
|
8475
8475
|
"stability": "stable",
|
|
8476
|
-
"summary": "CDK
|
|
8476
|
+
"summary": "CDK stack that deploys the EC2 instance running scheduler (EventBridge Scheduler + Durable Lambda)."
|
|
8477
8477
|
},
|
|
8478
8478
|
"fqn": "ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack",
|
|
8479
8479
|
"initializer": {
|
|
8480
8480
|
"docs": {
|
|
8481
8481
|
"stability": "stable",
|
|
8482
|
-
"summary": "Creates the stack and
|
|
8482
|
+
"summary": "Creates the stack and wires {@link EC2InstanceRunningScheduler}."
|
|
8483
8483
|
},
|
|
8484
8484
|
"locationInModule": {
|
|
8485
8485
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8486
|
-
"line":
|
|
8486
|
+
"line": 34
|
|
8487
8487
|
},
|
|
8488
8488
|
"parameters": [
|
|
8489
8489
|
{
|
|
8490
8490
|
"docs": {
|
|
8491
|
-
"summary": "- Parent construct."
|
|
8491
|
+
"summary": "- Parent construct or app."
|
|
8492
8492
|
},
|
|
8493
8493
|
"name": "scope",
|
|
8494
8494
|
"type": {
|
|
@@ -8506,7 +8506,7 @@
|
|
|
8506
8506
|
},
|
|
8507
8507
|
{
|
|
8508
8508
|
"docs": {
|
|
8509
|
-
"summary": "-
|
|
8509
|
+
"summary": "- Target resource, schedules, secrets, and standard stack props."
|
|
8510
8510
|
},
|
|
8511
8511
|
"name": "props",
|
|
8512
8512
|
"type": {
|
|
@@ -8518,7 +8518,7 @@
|
|
|
8518
8518
|
"kind": "class",
|
|
8519
8519
|
"locationInModule": {
|
|
8520
8520
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8521
|
-
"line":
|
|
8521
|
+
"line": 26
|
|
8522
8522
|
},
|
|
8523
8523
|
"name": "EC2InstanceRunningScheduleStack",
|
|
8524
8524
|
"symbolId": "src/stacks/ec2-instance-running-schedule-stack:EC2InstanceRunningScheduleStack"
|
|
@@ -8527,6 +8527,7 @@
|
|
|
8527
8527
|
"assembly": "ec2-instance-running-scheduler",
|
|
8528
8528
|
"datatype": true,
|
|
8529
8529
|
"docs": {
|
|
8530
|
+
"see": "{@link EC2InstanceRunningSchedulerProps } for construct-level options not exposed here (e.g. `resourcePolling`).",
|
|
8530
8531
|
"stability": "stable",
|
|
8531
8532
|
"summary": "Props for the EC2 instance running schedule CDK stack."
|
|
8532
8533
|
},
|
|
@@ -8537,7 +8538,7 @@
|
|
|
8537
8538
|
"kind": "interface",
|
|
8538
8539
|
"locationInModule": {
|
|
8539
8540
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8540
|
-
"line":
|
|
8541
|
+
"line": 10
|
|
8541
8542
|
},
|
|
8542
8543
|
"name": "EC2InstanceRunningScheduleStackProps",
|
|
8543
8544
|
"properties": [
|
|
@@ -8550,7 +8551,7 @@
|
|
|
8550
8551
|
"immutable": true,
|
|
8551
8552
|
"locationInModule": {
|
|
8552
8553
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8553
|
-
"line":
|
|
8554
|
+
"line": 16
|
|
8554
8555
|
},
|
|
8555
8556
|
"name": "secrets",
|
|
8556
8557
|
"type": {
|
|
@@ -8566,7 +8567,7 @@
|
|
|
8566
8567
|
"immutable": true,
|
|
8567
8568
|
"locationInModule": {
|
|
8568
8569
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8569
|
-
"line":
|
|
8570
|
+
"line": 12
|
|
8570
8571
|
},
|
|
8571
8572
|
"name": "targetResource",
|
|
8572
8573
|
"type": {
|
|
@@ -8583,7 +8584,7 @@
|
|
|
8583
8584
|
"immutable": true,
|
|
8584
8585
|
"locationInModule": {
|
|
8585
8586
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8586
|
-
"line":
|
|
8587
|
+
"line": 14
|
|
8587
8588
|
},
|
|
8588
8589
|
"name": "enableScheduling",
|
|
8589
8590
|
"optional": true,
|
|
@@ -8600,7 +8601,7 @@
|
|
|
8600
8601
|
"immutable": true,
|
|
8601
8602
|
"locationInModule": {
|
|
8602
8603
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8603
|
-
"line":
|
|
8604
|
+
"line": 20
|
|
8604
8605
|
},
|
|
8605
8606
|
"name": "startSchedule",
|
|
8606
8607
|
"optional": true,
|
|
@@ -8617,7 +8618,7 @@
|
|
|
8617
8618
|
"immutable": true,
|
|
8618
8619
|
"locationInModule": {
|
|
8619
8620
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8620
|
-
"line":
|
|
8621
|
+
"line": 18
|
|
8621
8622
|
},
|
|
8622
8623
|
"name": "stopSchedule",
|
|
8623
8624
|
"optional": true,
|
|
@@ -8632,7 +8633,7 @@
|
|
|
8632
8633
|
"assembly": "ec2-instance-running-scheduler",
|
|
8633
8634
|
"base": "constructs.Construct",
|
|
8634
8635
|
"docs": {
|
|
8635
|
-
"remarks": "Each schedule invokes the function with `Params` (`TagKey`, `TagValues`, `Mode`). The function uses\nthe Resource Groups Tagging API and EC2 APIs; Slack notifications use the secret named in {@link Secrets.slackSecretName}.",
|
|
8636
|
+
"remarks": "Each schedule invokes the function with `Params` (`TagKey`, `TagValues`, `Mode`). The function uses\nthe Resource Groups Tagging API and EC2 APIs; Slack notifications use the secret named in {@link Secrets.slackSecretName}.\n\nPer-instance polling timeouts are configured via {@link EC2InstanceRunningSchedulerProps.resourcePolling}\nand enforced in the handler before the Durable execution timeout.",
|
|
8636
8637
|
"stability": "stable",
|
|
8637
8638
|
"summary": "Provisions EventBridge Scheduler rules and a Durable Execution Lambda that start/stop tagged EC2 instances."
|
|
8638
8639
|
},
|
|
@@ -8644,7 +8645,7 @@
|
|
|
8644
8645
|
},
|
|
8645
8646
|
"locationInModule": {
|
|
8646
8647
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8647
|
-
"line":
|
|
8648
|
+
"line": 109
|
|
8648
8649
|
},
|
|
8649
8650
|
"parameters": [
|
|
8650
8651
|
{
|
|
@@ -8667,7 +8668,7 @@
|
|
|
8667
8668
|
},
|
|
8668
8669
|
{
|
|
8669
8670
|
"docs": {
|
|
8670
|
-
"summary": "- Target tags,
|
|
8671
|
+
"summary": "- Target tags, schedules, Slack secret, schedule enable flag, and optional {@link ResourcePollingLimits}."
|
|
8671
8672
|
},
|
|
8672
8673
|
"name": "props",
|
|
8673
8674
|
"type": {
|
|
@@ -8679,7 +8680,7 @@
|
|
|
8679
8680
|
"kind": "class",
|
|
8680
8681
|
"locationInModule": {
|
|
8681
8682
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8682
|
-
"line":
|
|
8683
|
+
"line": 101
|
|
8683
8684
|
},
|
|
8684
8685
|
"name": "EC2InstanceRunningScheduler",
|
|
8685
8686
|
"symbolId": "src/constructs/ec2-instance-running-scheduler:EC2InstanceRunningScheduler"
|
|
@@ -8695,7 +8696,7 @@
|
|
|
8695
8696
|
"kind": "interface",
|
|
8696
8697
|
"locationInModule": {
|
|
8697
8698
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8698
|
-
"line":
|
|
8699
|
+
"line": 73
|
|
8699
8700
|
},
|
|
8700
8701
|
"name": "EC2InstanceRunningSchedulerProps",
|
|
8701
8702
|
"properties": [
|
|
@@ -8708,7 +8709,7 @@
|
|
|
8708
8709
|
"immutable": true,
|
|
8709
8710
|
"locationInModule": {
|
|
8710
8711
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8711
|
-
"line":
|
|
8712
|
+
"line": 79
|
|
8712
8713
|
},
|
|
8713
8714
|
"name": "secrets",
|
|
8714
8715
|
"type": {
|
|
@@ -8724,7 +8725,7 @@
|
|
|
8724
8725
|
"immutable": true,
|
|
8725
8726
|
"locationInModule": {
|
|
8726
8727
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8727
|
-
"line":
|
|
8728
|
+
"line": 75
|
|
8728
8729
|
},
|
|
8729
8730
|
"name": "targetResource",
|
|
8730
8731
|
"type": {
|
|
@@ -8741,7 +8742,7 @@
|
|
|
8741
8742
|
"immutable": true,
|
|
8742
8743
|
"locationInModule": {
|
|
8743
8744
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8744
|
-
"line":
|
|
8745
|
+
"line": 77
|
|
8745
8746
|
},
|
|
8746
8747
|
"name": "enableScheduling",
|
|
8747
8748
|
"optional": true,
|
|
@@ -8749,6 +8750,24 @@
|
|
|
8749
8750
|
"primitive": "boolean"
|
|
8750
8751
|
}
|
|
8751
8752
|
},
|
|
8753
|
+
{
|
|
8754
|
+
"abstract": true,
|
|
8755
|
+
"docs": {
|
|
8756
|
+
"default": "{@link DEFAULT_RESOURCE_POLLING_LIMITS }",
|
|
8757
|
+
"stability": "stable",
|
|
8758
|
+
"summary": "Per-instance polling limits for the running scheduler Lambda."
|
|
8759
|
+
},
|
|
8760
|
+
"immutable": true,
|
|
8761
|
+
"locationInModule": {
|
|
8762
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8763
|
+
"line": 89
|
|
8764
|
+
},
|
|
8765
|
+
"name": "resourcePolling",
|
|
8766
|
+
"optional": true,
|
|
8767
|
+
"type": {
|
|
8768
|
+
"fqn": "ec2-instance-running-scheduler.ResourcePollingLimits"
|
|
8769
|
+
}
|
|
8770
|
+
},
|
|
8752
8771
|
{
|
|
8753
8772
|
"abstract": true,
|
|
8754
8773
|
"docs": {
|
|
@@ -8758,7 +8777,7 @@
|
|
|
8758
8777
|
"immutable": true,
|
|
8759
8778
|
"locationInModule": {
|
|
8760
8779
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8761
|
-
"line":
|
|
8780
|
+
"line": 83
|
|
8762
8781
|
},
|
|
8763
8782
|
"name": "startSchedule",
|
|
8764
8783
|
"optional": true,
|
|
@@ -8775,7 +8794,7 @@
|
|
|
8775
8794
|
"immutable": true,
|
|
8776
8795
|
"locationInModule": {
|
|
8777
8796
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8778
|
-
"line":
|
|
8797
|
+
"line": 81
|
|
8779
8798
|
},
|
|
8780
8799
|
"name": "stopSchedule",
|
|
8781
8800
|
"optional": true,
|
|
@@ -8786,6 +8805,61 @@
|
|
|
8786
8805
|
],
|
|
8787
8806
|
"symbolId": "src/constructs/ec2-instance-running-scheduler:EC2InstanceRunningSchedulerProps"
|
|
8788
8807
|
},
|
|
8808
|
+
"ec2-instance-running-scheduler.ResourcePollingLimits": {
|
|
8809
|
+
"assembly": "ec2-instance-running-scheduler",
|
|
8810
|
+
"datatype": true,
|
|
8811
|
+
"docs": {
|
|
8812
|
+
"remarks": "Values are written to {@link PROCESS_RESOURCE_MAX_LOOP_COUNT_ENV} and\n{@link PROCESS_RESOURCE_MAX_ELAPSED_SECONDS_ENV} on the running scheduler function.\nPrevents abnormal or stuck transitions from running until the Durable execution timeout.",
|
|
8813
|
+
"stability": "stable",
|
|
8814
|
+
"summary": "CDK-side limits for per-instance stable-state polling in the Durable Lambda handler."
|
|
8815
|
+
},
|
|
8816
|
+
"fqn": "ec2-instance-running-scheduler.ResourcePollingLimits",
|
|
8817
|
+
"kind": "interface",
|
|
8818
|
+
"locationInModule": {
|
|
8819
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8820
|
+
"line": 55
|
|
8821
|
+
},
|
|
8822
|
+
"name": "ResourcePollingLimits",
|
|
8823
|
+
"properties": [
|
|
8824
|
+
{
|
|
8825
|
+
"abstract": true,
|
|
8826
|
+
"docs": {
|
|
8827
|
+
"default": "{@link DEFAULT_RESOURCE_POLLING_LIMITS.maxElapsedSeconds } (1800, 30 minutes)",
|
|
8828
|
+
"stability": "stable",
|
|
8829
|
+
"summary": "Maximum wall-clock seconds spent polling a single instance."
|
|
8830
|
+
},
|
|
8831
|
+
"immutable": true,
|
|
8832
|
+
"locationInModule": {
|
|
8833
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8834
|
+
"line": 67
|
|
8835
|
+
},
|
|
8836
|
+
"name": "maxElapsedSeconds",
|
|
8837
|
+
"optional": true,
|
|
8838
|
+
"type": {
|
|
8839
|
+
"primitive": "number"
|
|
8840
|
+
}
|
|
8841
|
+
},
|
|
8842
|
+
{
|
|
8843
|
+
"abstract": true,
|
|
8844
|
+
"docs": {
|
|
8845
|
+
"default": "{@link DEFAULT_RESOURCE_POLLING_LIMITS.maxLoopCount } (90)",
|
|
8846
|
+
"stability": "stable",
|
|
8847
|
+
"summary": "Maximum describe/poll loop iterations per instance."
|
|
8848
|
+
},
|
|
8849
|
+
"immutable": true,
|
|
8850
|
+
"locationInModule": {
|
|
8851
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8852
|
+
"line": 61
|
|
8853
|
+
},
|
|
8854
|
+
"name": "maxLoopCount",
|
|
8855
|
+
"optional": true,
|
|
8856
|
+
"type": {
|
|
8857
|
+
"primitive": "number"
|
|
8858
|
+
}
|
|
8859
|
+
}
|
|
8860
|
+
],
|
|
8861
|
+
"symbolId": "src/constructs/ec2-instance-running-scheduler:ResourcePollingLimits"
|
|
8862
|
+
},
|
|
8789
8863
|
"ec2-instance-running-scheduler.Schedule": {
|
|
8790
8864
|
"assembly": "ec2-instance-running-scheduler",
|
|
8791
8865
|
"datatype": true,
|
|
@@ -8797,7 +8871,7 @@
|
|
|
8797
8871
|
"kind": "interface",
|
|
8798
8872
|
"locationInModule": {
|
|
8799
8873
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8800
|
-
"line":
|
|
8874
|
+
"line": 19
|
|
8801
8875
|
},
|
|
8802
8876
|
"name": "Schedule",
|
|
8803
8877
|
"properties": [
|
|
@@ -8810,7 +8884,7 @@
|
|
|
8810
8884
|
"immutable": true,
|
|
8811
8885
|
"locationInModule": {
|
|
8812
8886
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8813
|
-
"line":
|
|
8887
|
+
"line": 21
|
|
8814
8888
|
},
|
|
8815
8889
|
"name": "timezone",
|
|
8816
8890
|
"type": {
|
|
@@ -8826,7 +8900,7 @@
|
|
|
8826
8900
|
"immutable": true,
|
|
8827
8901
|
"locationInModule": {
|
|
8828
8902
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8829
|
-
"line":
|
|
8903
|
+
"line": 25
|
|
8830
8904
|
},
|
|
8831
8905
|
"name": "hour",
|
|
8832
8906
|
"optional": true,
|
|
@@ -8843,7 +8917,7 @@
|
|
|
8843
8917
|
"immutable": true,
|
|
8844
8918
|
"locationInModule": {
|
|
8845
8919
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8846
|
-
"line":
|
|
8920
|
+
"line": 23
|
|
8847
8921
|
},
|
|
8848
8922
|
"name": "minute",
|
|
8849
8923
|
"optional": true,
|
|
@@ -8860,7 +8934,7 @@
|
|
|
8860
8934
|
"immutable": true,
|
|
8861
8935
|
"locationInModule": {
|
|
8862
8936
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8863
|
-
"line":
|
|
8937
|
+
"line": 27
|
|
8864
8938
|
},
|
|
8865
8939
|
"name": "week",
|
|
8866
8940
|
"optional": true,
|
|
@@ -8882,7 +8956,7 @@
|
|
|
8882
8956
|
"kind": "interface",
|
|
8883
8957
|
"locationInModule": {
|
|
8884
8958
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8885
|
-
"line":
|
|
8959
|
+
"line": 43
|
|
8886
8960
|
},
|
|
8887
8961
|
"name": "Secrets",
|
|
8888
8962
|
"properties": [
|
|
@@ -8895,7 +8969,7 @@
|
|
|
8895
8969
|
"immutable": true,
|
|
8896
8970
|
"locationInModule": {
|
|
8897
8971
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8898
|
-
"line":
|
|
8972
|
+
"line": 45
|
|
8899
8973
|
},
|
|
8900
8974
|
"name": "slackSecretName",
|
|
8901
8975
|
"type": {
|
|
@@ -8916,7 +8990,7 @@
|
|
|
8916
8990
|
"kind": "interface",
|
|
8917
8991
|
"locationInModule": {
|
|
8918
8992
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8919
|
-
"line":
|
|
8993
|
+
"line": 33
|
|
8920
8994
|
},
|
|
8921
8995
|
"name": "TargetResource",
|
|
8922
8996
|
"properties": [
|
|
@@ -8929,7 +9003,7 @@
|
|
|
8929
9003
|
"immutable": true,
|
|
8930
9004
|
"locationInModule": {
|
|
8931
9005
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8932
|
-
"line":
|
|
9006
|
+
"line": 35
|
|
8933
9007
|
},
|
|
8934
9008
|
"name": "tagKey",
|
|
8935
9009
|
"type": {
|
|
@@ -8945,7 +9019,7 @@
|
|
|
8945
9019
|
"immutable": true,
|
|
8946
9020
|
"locationInModule": {
|
|
8947
9021
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8948
|
-
"line":
|
|
9022
|
+
"line": 37
|
|
8949
9023
|
},
|
|
8950
9024
|
"name": "tagValues",
|
|
8951
9025
|
"type": {
|
|
@@ -8961,6 +9035,6 @@
|
|
|
8961
9035
|
"symbolId": "src/constructs/ec2-instance-running-scheduler:TargetResource"
|
|
8962
9036
|
}
|
|
8963
9037
|
},
|
|
8964
|
-
"version": "0.
|
|
8965
|
-
"fingerprint": "
|
|
9038
|
+
"version": "0.2.0",
|
|
9039
|
+
"fingerprint": "ZBkhFyBBnj9zZ/mjKENeT68M92/whoAUuneVvx4m40o="
|
|
8966
9040
|
}
|
package/API.md
CHANGED
|
@@ -9,6 +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 polling timeouts are configured via {@link EC2InstanceRunningSchedulerProps.resourcePolling}
|
|
13
|
+
and enforced in the handler before the Durable execution timeout.
|
|
14
|
+
|
|
12
15
|
#### Initializers <a name="Initializers" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduler.Initializer"></a>
|
|
13
16
|
|
|
14
17
|
```typescript
|
|
@@ -21,7 +24,7 @@ new EC2InstanceRunningScheduler(scope: Construct, id: string, props: EC2Instance
|
|
|
21
24
|
| --- | --- | --- |
|
|
22
25
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduler.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | - Parent construct. |
|
|
23
26
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduler.Initializer.parameter.id">id</a></code> | <code>string</code> | - Construct id. |
|
|
24
|
-
| <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,
|
|
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 ResourcePollingLimits}. |
|
|
25
28
|
|
|
26
29
|
---
|
|
27
30
|
|
|
@@ -45,7 +48,7 @@ Construct id.
|
|
|
45
48
|
|
|
46
49
|
- *Type:* <a href="#ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps">EC2InstanceRunningSchedulerProps</a>
|
|
47
50
|
|
|
48
|
-
Target tags,
|
|
51
|
+
Target tags, schedules, Slack secret, schedule enable flag, and optional {@link ResourcePollingLimits}.
|
|
49
52
|
|
|
50
53
|
---
|
|
51
54
|
|
|
@@ -150,7 +153,7 @@ The tree node.
|
|
|
150
153
|
|
|
151
154
|
### EC2InstanceRunningScheduleStack <a name="EC2InstanceRunningScheduleStack" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack"></a>
|
|
152
155
|
|
|
153
|
-
CDK
|
|
156
|
+
CDK stack that deploys the EC2 instance running scheduler (EventBridge Scheduler + Durable Lambda).
|
|
154
157
|
|
|
155
158
|
#### Initializers <a name="Initializers" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer"></a>
|
|
156
159
|
|
|
@@ -162,9 +165,9 @@ new EC2InstanceRunningScheduleStack(scope: Construct, id: string, props: EC2Inst
|
|
|
162
165
|
|
|
163
166
|
| **Name** | **Type** | **Description** |
|
|
164
167
|
| --- | --- | --- |
|
|
165
|
-
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | - Parent construct. |
|
|
168
|
+
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | - Parent construct or app. |
|
|
166
169
|
| <code><a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStack.Initializer.parameter.id">id</a></code> | <code>string</code> | - Stack id. |
|
|
167
|
-
| <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> | -
|
|
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. |
|
|
168
171
|
|
|
169
172
|
---
|
|
170
173
|
|
|
@@ -172,7 +175,7 @@ new EC2InstanceRunningScheduleStack(scope: Construct, id: string, props: EC2Inst
|
|
|
172
175
|
|
|
173
176
|
- *Type:* constructs.Construct
|
|
174
177
|
|
|
175
|
-
Parent construct.
|
|
178
|
+
Parent construct or app.
|
|
176
179
|
|
|
177
180
|
---
|
|
178
181
|
|
|
@@ -188,7 +191,7 @@ Stack id.
|
|
|
188
191
|
|
|
189
192
|
- *Type:* <a href="#ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps">EC2InstanceRunningScheduleStackProps</a>
|
|
190
193
|
|
|
191
|
-
|
|
194
|
+
Target resource, schedules, secrets, and standard stack props.
|
|
192
195
|
|
|
193
196
|
---
|
|
194
197
|
|
|
@@ -1126,6 +1129,7 @@ const eC2InstanceRunningSchedulerProps: EC2InstanceRunningSchedulerProps = { ...
|
|
|
1126
1129
|
| <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. |
|
|
1127
1130
|
| <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. |
|
|
1128
1131
|
| <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.resourcePolling">resourcePolling</a></code> | <code><a href="#ec2-instance-running-scheduler.ResourcePollingLimits">ResourcePollingLimits</a></code> | Per-instance polling limits for the running scheduler Lambda. |
|
|
1129
1133
|
| <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. |
|
|
1130
1134
|
| <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. |
|
|
1131
1135
|
|
|
@@ -1169,6 +1173,19 @@ Defaults to true if omitted.
|
|
|
1169
1173
|
|
|
1170
1174
|
---
|
|
1171
1175
|
|
|
1176
|
+
##### `resourcePolling`<sup>Optional</sup> <a name="resourcePolling" id="ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.resourcePolling"></a>
|
|
1177
|
+
|
|
1178
|
+
```typescript
|
|
1179
|
+
public readonly resourcePolling: ResourcePollingLimits;
|
|
1180
|
+
```
|
|
1181
|
+
|
|
1182
|
+
- *Type:* <a href="#ec2-instance-running-scheduler.ResourcePollingLimits">ResourcePollingLimits</a>
|
|
1183
|
+
- *Default:* {@link DEFAULT_RESOURCE_POLLING_LIMITS }
|
|
1184
|
+
|
|
1185
|
+
Per-instance polling limits for the running scheduler Lambda.
|
|
1186
|
+
|
|
1187
|
+
---
|
|
1188
|
+
|
|
1172
1189
|
##### `startSchedule`<sup>Optional</sup> <a name="startSchedule" id="ec2-instance-running-scheduler.EC2InstanceRunningSchedulerProps.property.startSchedule"></a>
|
|
1173
1190
|
|
|
1174
1191
|
```typescript
|
|
@@ -1197,6 +1214,8 @@ Cron schedule for stopping instances.
|
|
|
1197
1214
|
|
|
1198
1215
|
Props for the EC2 instance running schedule CDK stack.
|
|
1199
1216
|
|
|
1217
|
+
> [{@link EC2InstanceRunningSchedulerProps } for construct-level options not exposed here (e.g. `resourcePolling`).]({@link EC2InstanceRunningSchedulerProps } for construct-level options not exposed here (e.g. `resourcePolling`).)
|
|
1218
|
+
|
|
1200
1219
|
#### Initializer <a name="Initializer" id="ec2-instance-running-scheduler.EC2InstanceRunningScheduleStackProps.Initializer"></a>
|
|
1201
1220
|
|
|
1202
1221
|
```typescript
|
|
@@ -1535,6 +1554,57 @@ Cron schedule for stopping instances.
|
|
|
1535
1554
|
|
|
1536
1555
|
---
|
|
1537
1556
|
|
|
1557
|
+
### ResourcePollingLimits <a name="ResourcePollingLimits" id="ec2-instance-running-scheduler.ResourcePollingLimits"></a>
|
|
1558
|
+
|
|
1559
|
+
CDK-side limits for per-instance stable-state polling in the Durable Lambda handler.
|
|
1560
|
+
|
|
1561
|
+
Values are written to {@link PROCESS_RESOURCE_MAX_LOOP_COUNT_ENV} and
|
|
1562
|
+
{@link PROCESS_RESOURCE_MAX_ELAPSED_SECONDS_ENV} on the running scheduler function.
|
|
1563
|
+
Prevents abnormal or stuck transitions from running until the Durable execution timeout.
|
|
1564
|
+
|
|
1565
|
+
#### Initializer <a name="Initializer" id="ec2-instance-running-scheduler.ResourcePollingLimits.Initializer"></a>
|
|
1566
|
+
|
|
1567
|
+
```typescript
|
|
1568
|
+
import { ResourcePollingLimits } from 'ec2-instance-running-scheduler'
|
|
1569
|
+
|
|
1570
|
+
const resourcePollingLimits: ResourcePollingLimits = { ... }
|
|
1571
|
+
```
|
|
1572
|
+
|
|
1573
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1574
|
+
|
|
1575
|
+
| **Name** | **Type** | **Description** |
|
|
1576
|
+
| --- | --- | --- |
|
|
1577
|
+
| <code><a href="#ec2-instance-running-scheduler.ResourcePollingLimits.property.maxElapsedSeconds">maxElapsedSeconds</a></code> | <code>number</code> | Maximum wall-clock seconds spent polling a single instance. |
|
|
1578
|
+
| <code><a href="#ec2-instance-running-scheduler.ResourcePollingLimits.property.maxLoopCount">maxLoopCount</a></code> | <code>number</code> | Maximum describe/poll loop iterations per instance. |
|
|
1579
|
+
|
|
1580
|
+
---
|
|
1581
|
+
|
|
1582
|
+
##### `maxElapsedSeconds`<sup>Optional</sup> <a name="maxElapsedSeconds" id="ec2-instance-running-scheduler.ResourcePollingLimits.property.maxElapsedSeconds"></a>
|
|
1583
|
+
|
|
1584
|
+
```typescript
|
|
1585
|
+
public readonly maxElapsedSeconds: number;
|
|
1586
|
+
```
|
|
1587
|
+
|
|
1588
|
+
- *Type:* number
|
|
1589
|
+
- *Default:* {@link DEFAULT_RESOURCE_POLLING_LIMITS.maxElapsedSeconds } (1800, 30 minutes)
|
|
1590
|
+
|
|
1591
|
+
Maximum wall-clock seconds spent polling a single instance.
|
|
1592
|
+
|
|
1593
|
+
---
|
|
1594
|
+
|
|
1595
|
+
##### `maxLoopCount`<sup>Optional</sup> <a name="maxLoopCount" id="ec2-instance-running-scheduler.ResourcePollingLimits.property.maxLoopCount"></a>
|
|
1596
|
+
|
|
1597
|
+
```typescript
|
|
1598
|
+
public readonly maxLoopCount: number;
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1601
|
+
- *Type:* number
|
|
1602
|
+
- *Default:* {@link DEFAULT_RESOURCE_POLLING_LIMITS.maxLoopCount } (90)
|
|
1603
|
+
|
|
1604
|
+
Maximum describe/poll loop iterations per instance.
|
|
1605
|
+
|
|
1606
|
+
---
|
|
1607
|
+
|
|
1538
1608
|
### Schedule <a name="Schedule" id="ec2-instance-running-scheduler.Schedule"></a>
|
|
1539
1609
|
|
|
1540
1610
|
Cron-style schedule configuration for start/stop actions.
|