ec2-instance-running-scheduler 0.3.6 → 0.4.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/.devcontainer/devcontainer.json +4 -3
- package/.jsii +298 -41
- package/API.md +239 -6
- package/README.md +76 -11
- package/assets/funcs/running-scheduler.lambda/index.js +355 -54
- package/assets/funcs/running-scheduler.lambda/index.js.map +4 -4
- package/lib/constructs/ec2-instance-running-scheduler.d.ts +105 -3
- package/lib/constructs/ec2-instance-running-scheduler.js +101 -17
- package/lib/constructs/running-scheduler-failure-detection.js +1 -1
- package/lib/funcs/running-scheduler-predicates.d.ts +4 -0
- package/lib/funcs/running-scheduler-predicates.js +5 -2
- package/lib/funcs/running-scheduler-wait-config.d.ts +13 -1
- package/lib/funcs/running-scheduler-wait-config.js +15 -3
- package/lib/funcs/running-scheduler-wait-env.d.ts +8 -2
- package/lib/funcs/running-scheduler-wait-env.js +29 -27
- package/lib/funcs/running-scheduler.lambda.d.ts +8 -5
- package/lib/funcs/running-scheduler.lambda.js +44 -21
- package/lib/stacks/ec2-instance-running-schedule-stack.d.ts +6 -3
- package/lib/stacks/ec2-instance-running-schedule-stack.js +6 -4
- package/package.json +13 -13
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": "
|
|
8443
|
+
"jsiiVersion": "6.0.10 (build bb45f01)",
|
|
8444
8444
|
"keywords": [
|
|
8445
8445
|
"cdk",
|
|
8446
8446
|
"durable",
|
|
@@ -8462,7 +8462,7 @@
|
|
|
8462
8462
|
},
|
|
8463
8463
|
"name": "ec2-instance-running-scheduler",
|
|
8464
8464
|
"readme": {
|
|
8465
|
-
"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, **waits 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 waiting** – After start/stop, the function waits (20 seconds between attempts) and re-describes instances until `running` (start mode) or `stopped` (stop mode).\n- **Configurable wait limits** – Per-instance **max loop count** and **max elapsed time** via `resourceWait` (default: 90 loops / 1800 seconds). Failures use explicit `ResourceWaitFailed:*` messages instead of running until the Durable execution timeout (construct default: 2 hours).\n- **Validated environment variables** – The bundled handler parses env vars with **strict-env-resolver** (`StrictEnvResolver`). `SLACK_SECRET_NAME` is required; wait limits must be **finite positive numbers** (`> 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, wait limit errors, Slack steps, completion).\n- **Optional failure detection** – CloudWatch alarms and log-based metrics for Lambda errors, instance wait failures (`ResourceWaitFailed`), Slack post failures, and other handler `ERROR` logs. Optional SNS notifications via a caller-supplied topic (`failureDetection.alarmTopic`).\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 * as sns from 'aws-cdk-lib/aws-sns';\nimport { EC2InstanceRunningScheduler } from 'ec2-instance-running-scheduler';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'MyStack');\n\nconst alarmTopic = new sns.Topic(stack, 'OpsAlerts');\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 resourceWait: {\n maxLoopCount: 120,\n maxElapsedSeconds: 3600,\n },\n failureDetection: {\n enabled: true,\n alarmTopic,\n },\n});\n```\n\nUse the **stack** `EC2InstanceRunningScheduleStack` when deploying the scheduler as its own stack. It accepts the same **targeting, schedules, secrets, enable flag, and failure detection** as the construct (plus standard `StackProps` such as `env`). For **`resourceWait`**, 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 * as sns from 'aws-cdk-lib/aws-sns';\nimport { EC2InstanceRunningScheduleStack } from 'ec2-instance-running-scheduler';\n\nconst app = new cdk.App();\n\nconst alarmTopic = sns.Topic.fromTopicArn(\n app,\n 'OpsAlerts',\n 'arn:aws:sns:ap-northeast-1:123456789012:ops-alerts',\n);\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 failureDetection: {\n enabled: true,\n alarmTopic,\n },\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` | `resourceWait.maxLoopCount` (default `90`) | Max describe/wait iterations per instance |\n| `PROCESS_RESOURCE_MAX_ELAPSED_SECONDS` | `resourceWait.maxElapsedSeconds` (default `1800`) | Max wall-clock seconds waiting for one instance |\n\nWhen you set wait limits via `resourceWait`, the construct writes them as decimal integer strings. At invocation the handler parses them with **strict-env-resolver**; each value must be a **finite number greater than zero**. Missing `SLACK_SECRET_NAME` or invalid env values cause `StrictEnvValidationError` 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| `resourceWait` | `ResourceWaitLimits` | No | Per-instance wait caps (see below). |\n| `failureDetection` | `FailureDetectionAlarms` | No | Optional CloudWatch alarms and log-based metrics (see below). |\n\n### EC2InstanceRunningScheduleStack\n\nIncludes `targetResource`, `secrets`, `startSchedule`, `stopSchedule`, `enableScheduling`, `failureDetection`, and standard `StackProps`. Does **not** expose `resourceWait`; use `EC2InstanceRunningScheduler` when you need custom wait 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### ResourceWaitLimits\n\nWritten to `PROCESS_RESOURCE_MAX_LOOP_COUNT` and `PROCESS_RESOURCE_MAX_ELAPSED_SECONDS` on the running scheduler Lambda.\n\n- `maxLoopCount` – Maximum describe/wait loop iterations per instance (default: **90**). Must be a positive integer when set.\n- `maxElapsedSeconds` – Maximum wall-clock seconds spent waiting for one instance to stabilize (default: **1800**, 30 minutes). Must be a positive integer when set.\n\nWhen a limit is exceeded during waiting, the handler throws an error with prefix `ResourceWaitFailed:` (`MaxLoopCountExceeded`, `MaxElapsedTimeExceeded`, or `UnexpectedInstanceState` for unknown EC2 states).\n\n### FailureDetectionAlarms\n\nOptional operational failure detection. Alarms are created only when `enabled` is `true`.\n\n- `enabled` – When `true`, creates four CloudWatch alarms and three log metric filters (default: disabled when omitted).\n- `alarmTopic` – Optional `sns.ITopic` for alarm actions. The construct does **not** create an SNS topic; pass an existing or imported topic. When omitted, alarms are created without SNS actions.\n\nWhen enabled, the construct creates:\n\n| Alarm | Trigger |\n|-------|---------|\n| Lambda errors | `AWS/Lambda` `Errors` metric |\n| Instance status failure | Log filter: `ResourceWaitFailed` |\n| Slack post failure | Log filter: `running-scheduler: Slack post failed` |\n| Durable execution failure | Other handler `ERROR` logs (excluding the above) |\n\nCustom metrics are published under the `EC2InstanceRunningScheduler` namespace. Access the created alarms via `EC2InstanceRunningScheduler.failureDetection` when enabled.\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** (^0.6) and parses env vars via **strict-env-resolver** (^0.5). Secret fetch runs only inside Lambda (requires runtime `AWS_SESSION_TOKEN` and the extension layer); the library retries transient extension errors including cold-start \"not ready\" responses.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
|
|
8465
|
+
"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 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, **waits 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 waiting** – After start/stop, the function waits (`resourceWait.statusChangeWaitSeconds`, default **20** seconds between attempts) and re-describes instances until `running` (start mode) or `stopped` (stop mode).\n- **Configurable wait limits** – Per-instance **max loop count**, **max elapsed time**, and **status-change wait interval** via `resourceWait` (default: 90 loops / 1800 seconds / 20 seconds). Failures use explicit `ResourceWaitFailed:*` messages instead of running until the Durable execution timeout (construct default: 2 hours; override with `durable.executionTimeout`).\n- **Configurable Lambda runtime** – Memory, invoke timeout, and bounded instance concurrency via `runtime` (default: **512 MB** / **15 minutes** / **maxConcurrency 10**). Durable execution timeout and history retention via `durable` (default: **2 hours** / **1 day**).\n- **Configurable logs** – Log group retention and removal policy via `logGroup` (default: **3 months**, `RemovalPolicy.DESTROY`).\n- **Validated environment variables** – The bundled handler parses env vars with **strict-env-resolver** (`StrictEnvResolver`). `SLACK_SECRET_NAME` is required; wait limits and `maxConcurrency` must be **positive integers** (`>= 1`).\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, wait limit errors, Slack steps, completion).\n- **Optional failure detection** – CloudWatch alarms and log-based metrics for Lambda errors, instance wait failures (`ResourceWaitFailed`), Slack post failures, and other handler `ERROR` logs. Optional SNS notifications via a caller-supplied topic (`failureDetection.alarmTopic`).\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** – Start/stop is limited to EC2 instances in the stack account/region whose tags match `targetResource`. Slack secret read grant, **Parameters and Secrets Lambda Extension**, JSON logging, and a dedicated log group (override retention and removal policy via `logGroup`).\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 * as logs from 'aws-cdk-lib/aws-logs';\nimport * as sns from 'aws-cdk-lib/aws-sns';\nimport { EC2InstanceRunningScheduler } from 'ec2-instance-running-scheduler';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'MyStack');\n\nconst alarmTopic = new sns.Topic(stack, 'OpsAlerts');\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 resourceWait: {\n maxLoopCount: 120,\n maxElapsedSeconds: 3600,\n statusChangeWaitSeconds: 15,\n },\n runtime: {\n memorySize: 1024,\n timeout: cdk.Duration.minutes(15),\n maxConcurrency: 20,\n },\n durable: {\n executionTimeout: cdk.Duration.hours(4),\n retentionPeriod: cdk.Duration.days(7),\n },\n logGroup: {\n retention: logs.RetentionDays.ONE_YEAR,\n removalPolicy: cdk.RemovalPolicy.RETAIN,\n },\n failureDetection: {\n enabled: true,\n alarmTopic,\n },\n});\n```\n\nUse the **stack** `EC2InstanceRunningScheduleStack` when deploying the scheduler as its own stack. It accepts the same **targeting, schedules, secrets, enable flag, and failure detection** as the construct (plus standard `StackProps` such as `env`). For **`resourceWait`**, **`runtime`**, **`durable`**, and **`logGroup`**, 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 * as sns from 'aws-cdk-lib/aws-sns';\nimport { EC2InstanceRunningScheduleStack } from 'ec2-instance-running-scheduler';\n\nconst app = new cdk.App();\n\nconst alarmTopic = sns.Topic.fromTopicArn(\n app,\n 'OpsAlerts',\n 'arn:aws:sns:ap-northeast-1:123456789012:ops-alerts',\n);\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 failureDetection: {\n enabled: true,\n alarmTopic,\n },\n});\n```\n\n## Tag instances before scheduling\n\nThe scheduler only starts and stops EC2 instances that **already** have the tag key and one of the tag values in `targetResource`. Tag instances in the same account and region as the stack **before** enabling schedules.\n\n**AWS CLI**\n\n```bash\naws ec2 create-tags \\\n --resources i-0123456789abcdef0 \\\n --tags Key=Schedule,Value=YES\n```\n\n**Console** – EC2 → Instances → select the instance → Tags → Add `Schedule` = `YES` (or your `tagKey` / `tagValues`).\n\nIAM for `ec2:StartInstances` and `ec2:StopInstances` is limited to:\n\n- instance ARNs in the stack **account** and **region** (`arn:...:ec2:<region>:<account>:instance/*`)\n- instances whose `aws:ResourceTag/<tagKey>` matches one of `tagValues`\n\nAn instance without the tag is not discovered by `tag:GetResources`, and start/stop is denied even if an instance ID is known. `tag:GetResources` and `ec2:DescribeInstances` still use `Resource: *` because those APIs do not support resource-level permissions or resource-tag conditions.\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` | `resourceWait.maxLoopCount` (default `90`) | Max describe/wait iterations per instance |\n| `PROCESS_RESOURCE_MAX_ELAPSED_SECONDS` | `resourceWait.maxElapsedSeconds` (default `1800`) | Max wall-clock seconds waiting for one instance |\n| `PROCESS_RESOURCE_STATUS_CHANGE_WAIT_SECONDS` | `resourceWait.statusChangeWaitSeconds` (default `20`) | Seconds between describe/wait iterations |\n| `PROCESS_RESOURCES_MAX_CONCURRENCY` | `runtime.maxConcurrency` (default `10`) | Max instances processed in parallel |\n\nWhen you set wait limits via `resourceWait` or concurrency via `runtime.maxConcurrency`, the construct writes them as decimal integer strings. At invocation the handler parses them with **strict-env-resolver**; each value must be a **positive integer** (`>= 1`). Missing `SLACK_SECRET_NAME` or invalid env values cause `StrictEnvValidationError` 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| `resourceWait` | `ResourceWaitLimits` | No | Per-instance wait caps (see below). |\n| `runtime` | `RunningSchedulerRuntimeProps` | No | Lambda memory, invoke timeout, and map concurrency. |\n| `durable` | `RunningSchedulerDurableProps` | No | Durable execution timeout and history retention. |\n| `logGroup` | `RunningSchedulerLogGroupProps` | No | Function log group retention and removal policy. |\n| `failureDetection` | `FailureDetectionAlarms` | No | Optional CloudWatch alarms and log-based metrics (see below). |\n\n### EC2InstanceRunningScheduleStack\n\nIncludes `targetResource`, `secrets`, `startSchedule`, `stopSchedule`, `enableScheduling`, `failureDetection`, and standard `StackProps`. Does **not** expose `resourceWait`, `runtime`, `durable`, or `logGroup`; use `EC2InstanceRunningScheduler` when you need custom wait, Lambda, Durable, or log settings.\n\n### TargetResource\n\n- `tagKey` – Tag key used to select instances (e.g. `Schedule`). Required on each target instance before schedules run.\n- `tagValues` – Tag values that must match (e.g. `['YES']`). At least one value is required.\n\nSee [Tag instances before scheduling](#tag-instances-before-scheduling).\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### ResourceWaitLimits\n\nWritten to `PROCESS_RESOURCE_MAX_LOOP_COUNT`, `PROCESS_RESOURCE_MAX_ELAPSED_SECONDS`, and `PROCESS_RESOURCE_STATUS_CHANGE_WAIT_SECONDS` on the running scheduler Lambda.\n\n- `maxLoopCount` – Maximum describe/wait loop iterations per instance (default: **90**). Must be a positive integer when set.\n- `maxElapsedSeconds` – Maximum wall-clock seconds spent waiting for one instance to stabilize (default: **1800**, 30 minutes). Must be a positive integer when set.\n- `statusChangeWaitSeconds` – Seconds between describe iterations after start/stop or while transitioning (default: **20**). Must be a positive integer when set.\n\nWhen a limit is exceeded during waiting, the handler throws an error with prefix `ResourceWaitFailed:` (`MaxLoopCountExceeded`, `MaxElapsedTimeExceeded`, or `UnexpectedInstanceState` for unknown EC2 states).\n\n### RunningSchedulerRuntimeProps\n\nLambda invoke settings. Written `maxConcurrency` to `PROCESS_RESOURCES_MAX_CONCURRENCY`.\n\n- `memorySize` – Memory in MB (default: **512**). Must be a positive integer when set.\n- `timeout` – Lambda invoke timeout (default: **15 minutes**). AWS maximum is 15 minutes; durable waits continue under `durable.executionTimeout`.\n- `maxConcurrency` – Max instances processed in parallel (default: **10**). Must be a positive integer when set. Increase with instance count.\n\n### RunningSchedulerDurableProps\n\n- `executionTimeout` – Maximum durable execution duration (default: **2 hours**). Increase when many instances wait in sequence of batches.\n- `retentionPeriod` – Durable execution history retention (default: **1 day**).\n\n### RunningSchedulerLogGroupProps\n\n- `retention` – CloudWatch Logs retention (default: **`RetentionDays.THREE_MONTHS`**).\n- `removalPolicy` – Log group removal policy (default: **`RemovalPolicy.DESTROY`**).\n\n### FailureDetectionAlarms\n\nOptional operational failure detection. Alarms are created only when `enabled` is `true`.\n\n- `enabled` – When `true`, creates four CloudWatch alarms and three log metric filters (default: disabled when omitted).\n- `alarmTopic` – Optional `sns.ITopic` for alarm actions. The construct does **not** create an SNS topic; pass an existing or imported topic. When omitted, alarms are created without SNS actions.\n\nWhen enabled, the construct creates:\n\n| Alarm | Trigger |\n|-------|---------|\n| Lambda errors | `AWS/Lambda` `Errors` metric |\n| Instance status failure | Log filter: `ResourceWaitFailed` |\n| Slack post failure | Log filter: `running-scheduler: Slack post failed` |\n| Durable execution failure | Other handler `ERROR` logs (excluding the above) |\n\nCustom metrics are published under the `EC2InstanceRunningScheduler` namespace. Access the created alarms via `EC2InstanceRunningScheduler.failureDetection` when enabled.\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** (^0.7) and parses env vars via **strict-env-resolver** (^0.6). Secret fetch runs only inside Lambda (requires runtime `AWS_SESSION_TOKEN` and the extension layer); the library retries transient extension errors including cold-start \"not ready\" responses.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n"
|
|
8466
8466
|
},
|
|
8467
8467
|
"repository": {
|
|
8468
8468
|
"type": "git",
|
|
@@ -8479,7 +8479,7 @@
|
|
|
8479
8479
|
"assembly": "ec2-instance-running-scheduler",
|
|
8480
8480
|
"base": "aws-cdk-lib.Stack",
|
|
8481
8481
|
"docs": {
|
|
8482
|
-
"remarks": "Wires {@link EC2InstanceRunningScheduler} with targeting, schedules, secrets, scheduling toggle,\nand optional {@link FailureDetectionAlarms}. Does not expose {@link ResourceWaitLimits }; use the
|
|
8482
|
+
"remarks": "Wires {@link EC2InstanceRunningScheduler} with targeting, schedules, secrets, scheduling toggle,\nand optional {@link FailureDetectionAlarms}. Does not expose {@link ResourceWaitLimits },\n{@link RunningSchedulerRuntimeProps }, {@link RunningSchedulerDurableProps }, or\n{@link RunningSchedulerLogGroupProps }; use the construct directly when custom runtime,\nwait, durable, or log group settings are required.",
|
|
8483
8483
|
"stability": "stable",
|
|
8484
8484
|
"summary": "CDK stack that deploys the EC2 instance running scheduler (EventBridge Scheduler + Durable Lambda)."
|
|
8485
8485
|
},
|
|
@@ -8491,7 +8491,7 @@
|
|
|
8491
8491
|
},
|
|
8492
8492
|
"locationInModule": {
|
|
8493
8493
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8494
|
-
"line":
|
|
8494
|
+
"line": 43
|
|
8495
8495
|
},
|
|
8496
8496
|
"parameters": [
|
|
8497
8497
|
{
|
|
@@ -8526,7 +8526,7 @@
|
|
|
8526
8526
|
"kind": "class",
|
|
8527
8527
|
"locationInModule": {
|
|
8528
8528
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8529
|
-
"line":
|
|
8529
|
+
"line": 35
|
|
8530
8530
|
},
|
|
8531
8531
|
"name": "EC2InstanceRunningScheduleStack",
|
|
8532
8532
|
"symbolId": "src/stacks/ec2-instance-running-schedule-stack:EC2InstanceRunningScheduleStack"
|
|
@@ -8535,7 +8535,7 @@
|
|
|
8535
8535
|
"assembly": "ec2-instance-running-scheduler",
|
|
8536
8536
|
"datatype": true,
|
|
8537
8537
|
"docs": {
|
|
8538
|
-
"see": "{@link EC2InstanceRunningSchedulerProps } for construct-level options not exposed here
|
|
8538
|
+
"see": "{@link EC2InstanceRunningSchedulerProps } for construct-level options not exposed here\n(e.g. `resourceWait`, `runtime`, `durable`, `logGroup`).",
|
|
8539
8539
|
"stability": "stable",
|
|
8540
8540
|
"summary": "Props for the EC2 instance running schedule CDK stack."
|
|
8541
8541
|
},
|
|
@@ -8546,7 +8546,7 @@
|
|
|
8546
8546
|
"kind": "interface",
|
|
8547
8547
|
"locationInModule": {
|
|
8548
8548
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8549
|
-
"line":
|
|
8549
|
+
"line": 11
|
|
8550
8550
|
},
|
|
8551
8551
|
"name": "EC2InstanceRunningScheduleStackProps",
|
|
8552
8552
|
"properties": [
|
|
@@ -8559,7 +8559,7 @@
|
|
|
8559
8559
|
"immutable": true,
|
|
8560
8560
|
"locationInModule": {
|
|
8561
8561
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8562
|
-
"line":
|
|
8562
|
+
"line": 17
|
|
8563
8563
|
},
|
|
8564
8564
|
"name": "secrets",
|
|
8565
8565
|
"type": {
|
|
@@ -8575,7 +8575,7 @@
|
|
|
8575
8575
|
"immutable": true,
|
|
8576
8576
|
"locationInModule": {
|
|
8577
8577
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8578
|
-
"line":
|
|
8578
|
+
"line": 13
|
|
8579
8579
|
},
|
|
8580
8580
|
"name": "targetResource",
|
|
8581
8581
|
"type": {
|
|
@@ -8592,7 +8592,7 @@
|
|
|
8592
8592
|
"immutable": true,
|
|
8593
8593
|
"locationInModule": {
|
|
8594
8594
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8595
|
-
"line":
|
|
8595
|
+
"line": 15
|
|
8596
8596
|
},
|
|
8597
8597
|
"name": "enableScheduling",
|
|
8598
8598
|
"optional": true,
|
|
@@ -8609,7 +8609,7 @@
|
|
|
8609
8609
|
"immutable": true,
|
|
8610
8610
|
"locationInModule": {
|
|
8611
8611
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8612
|
-
"line":
|
|
8612
|
+
"line": 23
|
|
8613
8613
|
},
|
|
8614
8614
|
"name": "failureDetection",
|
|
8615
8615
|
"optional": true,
|
|
@@ -8626,7 +8626,7 @@
|
|
|
8626
8626
|
"immutable": true,
|
|
8627
8627
|
"locationInModule": {
|
|
8628
8628
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8629
|
-
"line":
|
|
8629
|
+
"line": 21
|
|
8630
8630
|
},
|
|
8631
8631
|
"name": "startSchedule",
|
|
8632
8632
|
"optional": true,
|
|
@@ -8643,7 +8643,7 @@
|
|
|
8643
8643
|
"immutable": true,
|
|
8644
8644
|
"locationInModule": {
|
|
8645
8645
|
"filename": "src/stacks/ec2-instance-running-schedule-stack.ts",
|
|
8646
|
-
"line":
|
|
8646
|
+
"line": 19
|
|
8647
8647
|
},
|
|
8648
8648
|
"name": "stopSchedule",
|
|
8649
8649
|
"optional": true,
|
|
@@ -8658,7 +8658,7 @@
|
|
|
8658
8658
|
"assembly": "ec2-instance-running-scheduler",
|
|
8659
8659
|
"base": "constructs.Construct",
|
|
8660
8660
|
"docs": {
|
|
8661
|
-
"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 wait timeouts are configured via {@link EC2InstanceRunningSchedulerProps.resourceWait}\nand enforced in the handler before the Durable execution timeout. Optional CloudWatch failure\ndetection is available via {@link EC2InstanceRunningSchedulerProps.failureDetection}.",
|
|
8661
|
+
"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 wait timeouts are configured via {@link EC2InstanceRunningSchedulerProps.resourceWait}\nand enforced in the handler before the Durable execution timeout. Lambda memory, invoke timeout,\nand map concurrency are set via {@link EC2InstanceRunningSchedulerProps.runtime}; Durable\nexecution timeout and history retention via {@link EC2InstanceRunningSchedulerProps.durable};\nlog retention via {@link EC2InstanceRunningSchedulerProps.logGroup}. Start/stop IAM is limited\nto instances tagged as {@link TargetResource}. Optional CloudWatch failure\ndetection is available via {@link EC2InstanceRunningSchedulerProps.failureDetection}.",
|
|
8662
8662
|
"stability": "stable",
|
|
8663
8663
|
"summary": "Provisions EventBridge Scheduler rules and a Durable Execution Lambda that start/stop tagged EC2 instances."
|
|
8664
8664
|
},
|
|
@@ -8670,7 +8670,7 @@
|
|
|
8670
8670
|
},
|
|
8671
8671
|
"locationInModule": {
|
|
8672
8672
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8673
|
-
"line":
|
|
8673
|
+
"line": 323
|
|
8674
8674
|
},
|
|
8675
8675
|
"parameters": [
|
|
8676
8676
|
{
|
|
@@ -8693,7 +8693,7 @@
|
|
|
8693
8693
|
},
|
|
8694
8694
|
{
|
|
8695
8695
|
"docs": {
|
|
8696
|
-
"summary": "- Target tags, schedules, Slack secret, schedule enable flag, optional {@link ResourceWaitLimits}, and optional {@link FailureDetectionAlarms}."
|
|
8696
|
+
"summary": "- Target tags, schedules, Slack secret, schedule enable flag, optional {@link ResourceWaitLimits}, {@link RunningSchedulerRuntimeProps}, {@link RunningSchedulerDurableProps}, {@link RunningSchedulerLogGroupProps}, and optional {@link FailureDetectionAlarms}."
|
|
8697
8697
|
},
|
|
8698
8698
|
"name": "props",
|
|
8699
8699
|
"type": {
|
|
@@ -8705,7 +8705,7 @@
|
|
|
8705
8705
|
"kind": "class",
|
|
8706
8706
|
"locationInModule": {
|
|
8707
8707
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8708
|
-
"line":
|
|
8708
|
+
"line": 308
|
|
8709
8709
|
},
|
|
8710
8710
|
"name": "EC2InstanceRunningScheduler",
|
|
8711
8711
|
"properties": [
|
|
@@ -8717,7 +8717,7 @@
|
|
|
8717
8717
|
"immutable": true,
|
|
8718
8718
|
"locationInModule": {
|
|
8719
8719
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8720
|
-
"line":
|
|
8720
|
+
"line": 310
|
|
8721
8721
|
},
|
|
8722
8722
|
"name": "failureDetection",
|
|
8723
8723
|
"optional": true,
|
|
@@ -8739,7 +8739,7 @@
|
|
|
8739
8739
|
"kind": "interface",
|
|
8740
8740
|
"locationInModule": {
|
|
8741
8741
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8742
|
-
"line":
|
|
8742
|
+
"line": 171
|
|
8743
8743
|
},
|
|
8744
8744
|
"name": "EC2InstanceRunningSchedulerProps",
|
|
8745
8745
|
"properties": [
|
|
@@ -8752,7 +8752,7 @@
|
|
|
8752
8752
|
"immutable": true,
|
|
8753
8753
|
"locationInModule": {
|
|
8754
8754
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8755
|
-
"line":
|
|
8755
|
+
"line": 177
|
|
8756
8756
|
},
|
|
8757
8757
|
"name": "secrets",
|
|
8758
8758
|
"type": {
|
|
@@ -8768,13 +8768,31 @@
|
|
|
8768
8768
|
"immutable": true,
|
|
8769
8769
|
"locationInModule": {
|
|
8770
8770
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8771
|
-
"line":
|
|
8771
|
+
"line": 173
|
|
8772
8772
|
},
|
|
8773
8773
|
"name": "targetResource",
|
|
8774
8774
|
"type": {
|
|
8775
8775
|
"fqn": "ec2-instance-running-scheduler.TargetResource"
|
|
8776
8776
|
}
|
|
8777
8777
|
},
|
|
8778
|
+
{
|
|
8779
|
+
"abstract": true,
|
|
8780
|
+
"docs": {
|
|
8781
|
+
"default": "executionTimeout 2 hours, retentionPeriod 1 day",
|
|
8782
|
+
"stability": "stable",
|
|
8783
|
+
"summary": "Durable Execution timeout and history retention."
|
|
8784
|
+
},
|
|
8785
|
+
"immutable": true,
|
|
8786
|
+
"locationInModule": {
|
|
8787
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8788
|
+
"line": 199
|
|
8789
|
+
},
|
|
8790
|
+
"name": "durable",
|
|
8791
|
+
"optional": true,
|
|
8792
|
+
"type": {
|
|
8793
|
+
"fqn": "ec2-instance-running-scheduler.RunningSchedulerDurableProps"
|
|
8794
|
+
}
|
|
8795
|
+
},
|
|
8778
8796
|
{
|
|
8779
8797
|
"abstract": true,
|
|
8780
8798
|
"docs": {
|
|
@@ -8785,7 +8803,7 @@
|
|
|
8785
8803
|
"immutable": true,
|
|
8786
8804
|
"locationInModule": {
|
|
8787
8805
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8788
|
-
"line":
|
|
8806
|
+
"line": 175
|
|
8789
8807
|
},
|
|
8790
8808
|
"name": "enableScheduling",
|
|
8791
8809
|
"optional": true,
|
|
@@ -8804,7 +8822,7 @@
|
|
|
8804
8822
|
"immutable": true,
|
|
8805
8823
|
"locationInModule": {
|
|
8806
8824
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8807
|
-
"line":
|
|
8825
|
+
"line": 213
|
|
8808
8826
|
},
|
|
8809
8827
|
"name": "failureDetection",
|
|
8810
8828
|
"optional": true,
|
|
@@ -8812,6 +8830,24 @@
|
|
|
8812
8830
|
"fqn": "ec2-instance-running-scheduler.FailureDetectionAlarms"
|
|
8813
8831
|
}
|
|
8814
8832
|
},
|
|
8833
|
+
{
|
|
8834
|
+
"abstract": true,
|
|
8835
|
+
"docs": {
|
|
8836
|
+
"default": "RetentionDays.THREE_MONTHS, RemovalPolicy.DESTROY",
|
|
8837
|
+
"stability": "stable",
|
|
8838
|
+
"summary": "CloudWatch Logs retention and removal policy for the function log group."
|
|
8839
|
+
},
|
|
8840
|
+
"immutable": true,
|
|
8841
|
+
"locationInModule": {
|
|
8842
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8843
|
+
"line": 205
|
|
8844
|
+
},
|
|
8845
|
+
"name": "logGroup",
|
|
8846
|
+
"optional": true,
|
|
8847
|
+
"type": {
|
|
8848
|
+
"fqn": "ec2-instance-running-scheduler.RunningSchedulerLogGroupProps"
|
|
8849
|
+
}
|
|
8850
|
+
},
|
|
8815
8851
|
{
|
|
8816
8852
|
"abstract": true,
|
|
8817
8853
|
"docs": {
|
|
@@ -8822,7 +8858,7 @@
|
|
|
8822
8858
|
"immutable": true,
|
|
8823
8859
|
"locationInModule": {
|
|
8824
8860
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8825
|
-
"line":
|
|
8861
|
+
"line": 187
|
|
8826
8862
|
},
|
|
8827
8863
|
"name": "resourceWait",
|
|
8828
8864
|
"optional": true,
|
|
@@ -8830,6 +8866,24 @@
|
|
|
8830
8866
|
"fqn": "ec2-instance-running-scheduler.ResourceWaitLimits"
|
|
8831
8867
|
}
|
|
8832
8868
|
},
|
|
8869
|
+
{
|
|
8870
|
+
"abstract": true,
|
|
8871
|
+
"docs": {
|
|
8872
|
+
"default": "512 MB, 15 minutes, {@link DEFAULT_MAX_CONCURRENCY } (10)",
|
|
8873
|
+
"stability": "stable",
|
|
8874
|
+
"summary": "Lambda memory, invoke timeout, and per-invocation instance concurrency."
|
|
8875
|
+
},
|
|
8876
|
+
"immutable": true,
|
|
8877
|
+
"locationInModule": {
|
|
8878
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8879
|
+
"line": 193
|
|
8880
|
+
},
|
|
8881
|
+
"name": "runtime",
|
|
8882
|
+
"optional": true,
|
|
8883
|
+
"type": {
|
|
8884
|
+
"fqn": "ec2-instance-running-scheduler.RunningSchedulerRuntimeProps"
|
|
8885
|
+
}
|
|
8886
|
+
},
|
|
8833
8887
|
{
|
|
8834
8888
|
"abstract": true,
|
|
8835
8889
|
"docs": {
|
|
@@ -8839,7 +8893,7 @@
|
|
|
8839
8893
|
"immutable": true,
|
|
8840
8894
|
"locationInModule": {
|
|
8841
8895
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8842
|
-
"line":
|
|
8896
|
+
"line": 181
|
|
8843
8897
|
},
|
|
8844
8898
|
"name": "startSchedule",
|
|
8845
8899
|
"optional": true,
|
|
@@ -8856,7 +8910,7 @@
|
|
|
8856
8910
|
"immutable": true,
|
|
8857
8911
|
"locationInModule": {
|
|
8858
8912
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8859
|
-
"line":
|
|
8913
|
+
"line": 179
|
|
8860
8914
|
},
|
|
8861
8915
|
"name": "stopSchedule",
|
|
8862
8916
|
"optional": true,
|
|
@@ -8935,7 +8989,7 @@
|
|
|
8935
8989
|
"kind": "interface",
|
|
8936
8990
|
"locationInModule": {
|
|
8937
8991
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8938
|
-
"line":
|
|
8992
|
+
"line": 77
|
|
8939
8993
|
},
|
|
8940
8994
|
"name": "ResourceWaitLimits",
|
|
8941
8995
|
"properties": [
|
|
@@ -8949,7 +9003,7 @@
|
|
|
8949
9003
|
"immutable": true,
|
|
8950
9004
|
"locationInModule": {
|
|
8951
9005
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8952
|
-
"line":
|
|
9006
|
+
"line": 89
|
|
8953
9007
|
},
|
|
8954
9008
|
"name": "maxElapsedSeconds",
|
|
8955
9009
|
"optional": true,
|
|
@@ -8967,17 +9021,91 @@
|
|
|
8967
9021
|
"immutable": true,
|
|
8968
9022
|
"locationInModule": {
|
|
8969
9023
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
8970
|
-
"line":
|
|
9024
|
+
"line": 83
|
|
8971
9025
|
},
|
|
8972
9026
|
"name": "maxLoopCount",
|
|
8973
9027
|
"optional": true,
|
|
8974
9028
|
"type": {
|
|
8975
9029
|
"primitive": "number"
|
|
8976
9030
|
}
|
|
9031
|
+
},
|
|
9032
|
+
{
|
|
9033
|
+
"abstract": true,
|
|
9034
|
+
"docs": {
|
|
9035
|
+
"default": "{@link DEFAULT_RESOURCE_WAIT_LIMITS.statusChangeWaitSeconds } (20)",
|
|
9036
|
+
"remarks": "Lower values detect state changes sooner; higher values reduce DescribeInstances calls.",
|
|
9037
|
+
"stability": "stable",
|
|
9038
|
+
"summary": "Seconds to wait between describe iterations after start/stop or while transitioning."
|
|
9039
|
+
},
|
|
9040
|
+
"immutable": true,
|
|
9041
|
+
"locationInModule": {
|
|
9042
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9043
|
+
"line": 97
|
|
9044
|
+
},
|
|
9045
|
+
"name": "statusChangeWaitSeconds",
|
|
9046
|
+
"optional": true,
|
|
9047
|
+
"type": {
|
|
9048
|
+
"primitive": "number"
|
|
9049
|
+
}
|
|
8977
9050
|
}
|
|
8978
9051
|
],
|
|
8979
9052
|
"symbolId": "src/constructs/ec2-instance-running-scheduler:ResourceWaitLimits"
|
|
8980
9053
|
},
|
|
9054
|
+
"ec2-instance-running-scheduler.RunningSchedulerDurableProps": {
|
|
9055
|
+
"assembly": "ec2-instance-running-scheduler",
|
|
9056
|
+
"datatype": true,
|
|
9057
|
+
"docs": {
|
|
9058
|
+
"stability": "stable",
|
|
9059
|
+
"summary": "Durable Execution timeout and history retention for the running scheduler Lambda."
|
|
9060
|
+
},
|
|
9061
|
+
"fqn": "ec2-instance-running-scheduler.RunningSchedulerDurableProps",
|
|
9062
|
+
"kind": "interface",
|
|
9063
|
+
"locationInModule": {
|
|
9064
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9065
|
+
"line": 133
|
|
9066
|
+
},
|
|
9067
|
+
"name": "RunningSchedulerDurableProps",
|
|
9068
|
+
"properties": [
|
|
9069
|
+
{
|
|
9070
|
+
"abstract": true,
|
|
9071
|
+
"docs": {
|
|
9072
|
+
"default": "Duration.hours(2)",
|
|
9073
|
+
"remarks": "Increase when many instances are processed with long per-instance waits.",
|
|
9074
|
+
"stability": "stable",
|
|
9075
|
+
"summary": "Maximum duration of a durable execution."
|
|
9076
|
+
},
|
|
9077
|
+
"immutable": true,
|
|
9078
|
+
"locationInModule": {
|
|
9079
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9080
|
+
"line": 141
|
|
9081
|
+
},
|
|
9082
|
+
"name": "executionTimeout",
|
|
9083
|
+
"optional": true,
|
|
9084
|
+
"type": {
|
|
9085
|
+
"fqn": "aws-cdk-lib.Duration"
|
|
9086
|
+
}
|
|
9087
|
+
},
|
|
9088
|
+
{
|
|
9089
|
+
"abstract": true,
|
|
9090
|
+
"docs": {
|
|
9091
|
+
"default": "Duration.days(1)",
|
|
9092
|
+
"stability": "stable",
|
|
9093
|
+
"summary": "How long to retain durable execution history."
|
|
9094
|
+
},
|
|
9095
|
+
"immutable": true,
|
|
9096
|
+
"locationInModule": {
|
|
9097
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9098
|
+
"line": 147
|
|
9099
|
+
},
|
|
9100
|
+
"name": "retentionPeriod",
|
|
9101
|
+
"optional": true,
|
|
9102
|
+
"type": {
|
|
9103
|
+
"fqn": "aws-cdk-lib.Duration"
|
|
9104
|
+
}
|
|
9105
|
+
}
|
|
9106
|
+
],
|
|
9107
|
+
"symbolId": "src/constructs/ec2-instance-running-scheduler:RunningSchedulerDurableProps"
|
|
9108
|
+
},
|
|
8981
9109
|
"ec2-instance-running-scheduler.RunningSchedulerFailureDetection": {
|
|
8982
9110
|
"assembly": "ec2-instance-running-scheduler",
|
|
8983
9111
|
"base": "constructs.Construct",
|
|
@@ -9177,6 +9305,134 @@
|
|
|
9177
9305
|
],
|
|
9178
9306
|
"symbolId": "src/constructs/running-scheduler-failure-detection:RunningSchedulerFailureDetectionProps"
|
|
9179
9307
|
},
|
|
9308
|
+
"ec2-instance-running-scheduler.RunningSchedulerLogGroupProps": {
|
|
9309
|
+
"assembly": "ec2-instance-running-scheduler",
|
|
9310
|
+
"datatype": true,
|
|
9311
|
+
"docs": {
|
|
9312
|
+
"stability": "stable",
|
|
9313
|
+
"summary": "CloudWatch Logs settings for the running scheduler function log group."
|
|
9314
|
+
},
|
|
9315
|
+
"fqn": "ec2-instance-running-scheduler.RunningSchedulerLogGroupProps",
|
|
9316
|
+
"kind": "interface",
|
|
9317
|
+
"locationInModule": {
|
|
9318
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9319
|
+
"line": 153
|
|
9320
|
+
},
|
|
9321
|
+
"name": "RunningSchedulerLogGroupProps",
|
|
9322
|
+
"properties": [
|
|
9323
|
+
{
|
|
9324
|
+
"abstract": true,
|
|
9325
|
+
"docs": {
|
|
9326
|
+
"default": "RemovalPolicy.DESTROY",
|
|
9327
|
+
"stability": "stable",
|
|
9328
|
+
"summary": "Removal policy for the log group."
|
|
9329
|
+
},
|
|
9330
|
+
"immutable": true,
|
|
9331
|
+
"locationInModule": {
|
|
9332
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9333
|
+
"line": 165
|
|
9334
|
+
},
|
|
9335
|
+
"name": "removalPolicy",
|
|
9336
|
+
"optional": true,
|
|
9337
|
+
"type": {
|
|
9338
|
+
"fqn": "aws-cdk-lib.RemovalPolicy"
|
|
9339
|
+
}
|
|
9340
|
+
},
|
|
9341
|
+
{
|
|
9342
|
+
"abstract": true,
|
|
9343
|
+
"docs": {
|
|
9344
|
+
"default": "RetentionDays.THREE_MONTHS",
|
|
9345
|
+
"stability": "stable",
|
|
9346
|
+
"summary": "How long to retain application logs."
|
|
9347
|
+
},
|
|
9348
|
+
"immutable": true,
|
|
9349
|
+
"locationInModule": {
|
|
9350
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9351
|
+
"line": 159
|
|
9352
|
+
},
|
|
9353
|
+
"name": "retention",
|
|
9354
|
+
"optional": true,
|
|
9355
|
+
"type": {
|
|
9356
|
+
"fqn": "aws-cdk-lib.aws_logs.RetentionDays"
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
],
|
|
9360
|
+
"symbolId": "src/constructs/ec2-instance-running-scheduler:RunningSchedulerLogGroupProps"
|
|
9361
|
+
},
|
|
9362
|
+
"ec2-instance-running-scheduler.RunningSchedulerRuntimeProps": {
|
|
9363
|
+
"assembly": "ec2-instance-running-scheduler",
|
|
9364
|
+
"datatype": true,
|
|
9365
|
+
"docs": {
|
|
9366
|
+
"remarks": "Increase {@link memorySize} and {@link maxConcurrency} when a single invocation targets\nmany instances or regions.",
|
|
9367
|
+
"stability": "stable",
|
|
9368
|
+
"summary": "Lambda invoke settings and bounded parallelism for the running scheduler function."
|
|
9369
|
+
},
|
|
9370
|
+
"fqn": "ec2-instance-running-scheduler.RunningSchedulerRuntimeProps",
|
|
9371
|
+
"kind": "interface",
|
|
9372
|
+
"locationInModule": {
|
|
9373
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9374
|
+
"line": 106
|
|
9375
|
+
},
|
|
9376
|
+
"name": "RunningSchedulerRuntimeProps",
|
|
9377
|
+
"properties": [
|
|
9378
|
+
{
|
|
9379
|
+
"abstract": true,
|
|
9380
|
+
"docs": {
|
|
9381
|
+
"default": "{@link DEFAULT_MAX_CONCURRENCY } (10)",
|
|
9382
|
+
"stability": "stable",
|
|
9383
|
+
"summary": "Maximum number of instances processed in parallel by the durable `map`."
|
|
9384
|
+
},
|
|
9385
|
+
"immutable": true,
|
|
9386
|
+
"locationInModule": {
|
|
9387
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9388
|
+
"line": 127
|
|
9389
|
+
},
|
|
9390
|
+
"name": "maxConcurrency",
|
|
9391
|
+
"optional": true,
|
|
9392
|
+
"type": {
|
|
9393
|
+
"primitive": "number"
|
|
9394
|
+
}
|
|
9395
|
+
},
|
|
9396
|
+
{
|
|
9397
|
+
"abstract": true,
|
|
9398
|
+
"docs": {
|
|
9399
|
+
"default": "512",
|
|
9400
|
+
"stability": "stable",
|
|
9401
|
+
"summary": "Memory allocated to the running scheduler Lambda, in MB."
|
|
9402
|
+
},
|
|
9403
|
+
"immutable": true,
|
|
9404
|
+
"locationInModule": {
|
|
9405
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9406
|
+
"line": 112
|
|
9407
|
+
},
|
|
9408
|
+
"name": "memorySize",
|
|
9409
|
+
"optional": true,
|
|
9410
|
+
"type": {
|
|
9411
|
+
"primitive": "number"
|
|
9412
|
+
}
|
|
9413
|
+
},
|
|
9414
|
+
{
|
|
9415
|
+
"abstract": true,
|
|
9416
|
+
"docs": {
|
|
9417
|
+
"default": "Duration.minutes(15)",
|
|
9418
|
+
"remarks": "AWS Lambda's maximum invoke timeout is 15 minutes. Durable waits can continue\nbeyond this via {@link RunningSchedulerDurableProps.executionTimeout}.",
|
|
9419
|
+
"stability": "stable",
|
|
9420
|
+
"summary": "Invoke timeout for the Lambda function (not the durable execution timeout)."
|
|
9421
|
+
},
|
|
9422
|
+
"immutable": true,
|
|
9423
|
+
"locationInModule": {
|
|
9424
|
+
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9425
|
+
"line": 121
|
|
9426
|
+
},
|
|
9427
|
+
"name": "timeout",
|
|
9428
|
+
"optional": true,
|
|
9429
|
+
"type": {
|
|
9430
|
+
"fqn": "aws-cdk-lib.Duration"
|
|
9431
|
+
}
|
|
9432
|
+
}
|
|
9433
|
+
],
|
|
9434
|
+
"symbolId": "src/constructs/ec2-instance-running-scheduler:RunningSchedulerRuntimeProps"
|
|
9435
|
+
},
|
|
9180
9436
|
"ec2-instance-running-scheduler.Schedule": {
|
|
9181
9437
|
"assembly": "ec2-instance-running-scheduler",
|
|
9182
9438
|
"datatype": true,
|
|
@@ -9188,7 +9444,7 @@
|
|
|
9188
9444
|
"kind": "interface",
|
|
9189
9445
|
"locationInModule": {
|
|
9190
9446
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9191
|
-
"line":
|
|
9447
|
+
"line": 35
|
|
9192
9448
|
},
|
|
9193
9449
|
"name": "Schedule",
|
|
9194
9450
|
"properties": [
|
|
@@ -9201,7 +9457,7 @@
|
|
|
9201
9457
|
"immutable": true,
|
|
9202
9458
|
"locationInModule": {
|
|
9203
9459
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9204
|
-
"line":
|
|
9460
|
+
"line": 37
|
|
9205
9461
|
},
|
|
9206
9462
|
"name": "timezone",
|
|
9207
9463
|
"type": {
|
|
@@ -9217,7 +9473,7 @@
|
|
|
9217
9473
|
"immutable": true,
|
|
9218
9474
|
"locationInModule": {
|
|
9219
9475
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9220
|
-
"line":
|
|
9476
|
+
"line": 41
|
|
9221
9477
|
},
|
|
9222
9478
|
"name": "hour",
|
|
9223
9479
|
"optional": true,
|
|
@@ -9234,7 +9490,7 @@
|
|
|
9234
9490
|
"immutable": true,
|
|
9235
9491
|
"locationInModule": {
|
|
9236
9492
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9237
|
-
"line":
|
|
9493
|
+
"line": 39
|
|
9238
9494
|
},
|
|
9239
9495
|
"name": "minute",
|
|
9240
9496
|
"optional": true,
|
|
@@ -9251,7 +9507,7 @@
|
|
|
9251
9507
|
"immutable": true,
|
|
9252
9508
|
"locationInModule": {
|
|
9253
9509
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9254
|
-
"line":
|
|
9510
|
+
"line": 43
|
|
9255
9511
|
},
|
|
9256
9512
|
"name": "week",
|
|
9257
9513
|
"optional": true,
|
|
@@ -9273,7 +9529,7 @@
|
|
|
9273
9529
|
"kind": "interface",
|
|
9274
9530
|
"locationInModule": {
|
|
9275
9531
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9276
|
-
"line":
|
|
9532
|
+
"line": 63
|
|
9277
9533
|
},
|
|
9278
9534
|
"name": "Secrets",
|
|
9279
9535
|
"properties": [
|
|
@@ -9286,7 +9542,7 @@
|
|
|
9286
9542
|
"immutable": true,
|
|
9287
9543
|
"locationInModule": {
|
|
9288
9544
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9289
|
-
"line":
|
|
9545
|
+
"line": 65
|
|
9290
9546
|
},
|
|
9291
9547
|
"name": "slackSecretName",
|
|
9292
9548
|
"type": {
|
|
@@ -9300,6 +9556,7 @@
|
|
|
9300
9556
|
"assembly": "ec2-instance-running-scheduler",
|
|
9301
9557
|
"datatype": true,
|
|
9302
9558
|
"docs": {
|
|
9559
|
+
"remarks": "Instances must already have this tag. IAM allows `ec2:StartInstances` /\n`ec2:StopInstances` only on instances in the stack account and region whose\n`aws:ResourceTag/<tagKey>` matches one of {@link TargetResource.tagValues}.",
|
|
9303
9560
|
"stability": "stable",
|
|
9304
9561
|
"summary": "Defines which EC2 instances are targeted by tag key and values."
|
|
9305
9562
|
},
|
|
@@ -9307,7 +9564,7 @@
|
|
|
9307
9564
|
"kind": "interface",
|
|
9308
9565
|
"locationInModule": {
|
|
9309
9566
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9310
|
-
"line":
|
|
9567
|
+
"line": 53
|
|
9311
9568
|
},
|
|
9312
9569
|
"name": "TargetResource",
|
|
9313
9570
|
"properties": [
|
|
@@ -9320,7 +9577,7 @@
|
|
|
9320
9577
|
"immutable": true,
|
|
9321
9578
|
"locationInModule": {
|
|
9322
9579
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9323
|
-
"line":
|
|
9580
|
+
"line": 55
|
|
9324
9581
|
},
|
|
9325
9582
|
"name": "tagKey",
|
|
9326
9583
|
"type": {
|
|
@@ -9336,7 +9593,7 @@
|
|
|
9336
9593
|
"immutable": true,
|
|
9337
9594
|
"locationInModule": {
|
|
9338
9595
|
"filename": "src/constructs/ec2-instance-running-scheduler.ts",
|
|
9339
|
-
"line":
|
|
9596
|
+
"line": 57
|
|
9340
9597
|
},
|
|
9341
9598
|
"name": "tagValues",
|
|
9342
9599
|
"type": {
|
|
@@ -9352,6 +9609,6 @@
|
|
|
9352
9609
|
"symbolId": "src/constructs/ec2-instance-running-scheduler:TargetResource"
|
|
9353
9610
|
}
|
|
9354
9611
|
},
|
|
9355
|
-
"version": "0.
|
|
9356
|
-
"fingerprint": "
|
|
9612
|
+
"version": "0.4.0",
|
|
9613
|
+
"fingerprint": "MPBp680fNiHH5tRorE3kFIcOLyFX4+T7nXmkQJPueQ8="
|
|
9357
9614
|
}
|