@mavogel/cdk-vscode-server 0.0.60 โ 0.0.62
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/.claude/hooks/file_checker.sh +3 -0
- package/.jsii +454 -31
- package/API.md +514 -0
- package/README.md +57 -0
- package/assets/idle-monitor/idle-monitor.lambda/index.js +110 -0
- package/assets/status-check/status-check.lambda/index.js +123 -0
- package/examples/auto-stop/main.ts +75 -0
- package/integ-tests/functions/idle-test-handler.ts +178 -0
- package/integ-tests/functions/login-handler.ts +62 -33
- package/integ-tests/integ.al2023.ts.snapshot/read.13497.1.lock +1 -0
- package/integ-tests/integ.custom-domain.ts.snapshot/read.13497.1.lock +1 -0
- package/integ-tests/integ.stop-on-idle.ts +175 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/IntegStopOnIdleFunctionalityDefaultTestDeployAssertEECF3FC0.assets.json +33 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/IntegStopOnIdleFunctionalityDefaultTestDeployAssertEECF3FC0.template.json +692 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/IntegTestStackStopOnIdle.assets.json +146 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/IntegTestStackStopOnIdle.template.json +3077 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.2819175352ad1ce0dae768e83fc328fb70fb5f10b4a8ff0ccbcb791f02b0716d/index.js +1 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.33da23274e25bd9f43638c5d83dad26e3931cbe78d462ffd9a9f565e948b4f5f.lambda/index.js +143 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.530055f7515b3f0a47900f5df37e729ba40ca977b2d07b952bdefa2b8f883f42.bundle/index.js +30676 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.781ab0ab74634cdaf61539ab208ab777829ef07097ac21f95b9e15a3b1eedc1b.lambda/index.js +57 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200/__entrypoint__.js +1 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200/index.js +1 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.8dd4be31c5a6cd8750dc55c07c1e2f19596f8a27b032d02c18554ed44eabe065.lambda/index.js +110 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.9d043014be736e8162bcc7ec5590cc6d2ff24fd0d9c73a5c5d595151c5fdad00/index.js +1 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.bdc104ed9cab1b5b6421713c8155f0b753380595356f710400609664d3635eca/cfn-response.js +1 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.bdc104ed9cab1b5b6421713c8155f0b753380595356f710400609664d3635eca/consts.js +1 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.bdc104ed9cab1b5b6421713c8155f0b753380595356f710400609664d3635eca/framework.js +3 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.bdc104ed9cab1b5b6421713c8155f0b753380595356f710400609664d3635eca/outbound.js +1 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.bdc104ed9cab1b5b6421713c8155f0b753380595356f710400609664d3635eca/util.js +1 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.d061a1ca61c6339fcb77bb6fc19194a60c96bb16531eaf1e4e733b50089512ca/index.js +118 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/asset.efac30c7091c58fed492058fa6403c14f7e58aab8cf4fd595d838b8d5eeec2b9/index.js +6017 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/integ.json +20 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/manifest.json +1942 -0
- package/integ-tests/integ.stop-on-idle.ts.snapshot/tree.json +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/read.13497.1.lock +1 -0
- package/lib/idle-monitor/idle-monitor-function.d.ts +13 -0
- package/lib/idle-monitor/idle-monitor-function.js +22 -0
- package/lib/idle-monitor/idle-monitor.d.ts +53 -0
- package/lib/idle-monitor/idle-monitor.js +84 -0
- package/lib/idle-monitor/idle-monitor.lambda.d.ts +2 -0
- package/lib/idle-monitor/idle-monitor.lambda.js +97 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/status-check/status-check-function.d.ts +13 -0
- package/lib/status-check/status-check-function.js +22 -0
- package/lib/status-check/status-check.d.ts +36 -0
- package/lib/status-check/status-check.js +109 -0
- package/lib/status-check/status-check.lambda.d.ts +2 -0
- package/lib/status-check/status-check.lambda.js +104 -0
- package/lib/vscode-server.d.ts +42 -0
- package/lib/vscode-server.js +51 -7
- package/mavogelcdkvscodeserver/go.mod +1 -1
- package/mavogelcdkvscodeserver/jsii/jsii.go +2 -2
- package/mavogelcdkvscodeserver/version +1 -1
- package/package.json +21 -16
package/API.md
CHANGED
|
@@ -2,6 +2,301 @@
|
|
|
2
2
|
|
|
3
3
|
## Constructs <a name="Constructs" id="Constructs"></a>
|
|
4
4
|
|
|
5
|
+
### IdleMonitor <a name="IdleMonitor" id="@mavogel/cdk-vscode-server.IdleMonitor"></a>
|
|
6
|
+
|
|
7
|
+
Construct that monitors CloudFront request metrics and stops the EC2 instance when idle.
|
|
8
|
+
|
|
9
|
+
#### Initializers <a name="Initializers" id="@mavogel/cdk-vscode-server.IdleMonitor.Initializer"></a>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { IdleMonitor } from '@mavogel/cdk-vscode-server'
|
|
13
|
+
|
|
14
|
+
new IdleMonitor(scope: Construct, id: string, props: IdleMonitorProps)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
| **Name** | **Type** | **Description** |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
20
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
21
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor.Initializer.parameter.props">props</a></code> | <code><a href="#@mavogel/cdk-vscode-server.IdleMonitorProps">IdleMonitorProps</a></code> | *No description.* |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@mavogel/cdk-vscode-server.IdleMonitor.Initializer.parameter.scope"></a>
|
|
26
|
+
|
|
27
|
+
- *Type:* constructs.Construct
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
##### `id`<sup>Required</sup> <a name="id" id="@mavogel/cdk-vscode-server.IdleMonitor.Initializer.parameter.id"></a>
|
|
32
|
+
|
|
33
|
+
- *Type:* string
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
##### `props`<sup>Required</sup> <a name="props" id="@mavogel/cdk-vscode-server.IdleMonitor.Initializer.parameter.props"></a>
|
|
38
|
+
|
|
39
|
+
- *Type:* <a href="#@mavogel/cdk-vscode-server.IdleMonitorProps">IdleMonitorProps</a>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
44
|
+
|
|
45
|
+
| **Name** | **Description** |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
##### `toString` <a name="toString" id="@mavogel/cdk-vscode-server.IdleMonitor.toString"></a>
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
public toString(): string
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Returns a string representation of this construct.
|
|
58
|
+
|
|
59
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
60
|
+
|
|
61
|
+
| **Name** | **Description** |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
##### `isConstruct` <a name="isConstruct" id="@mavogel/cdk-vscode-server.IdleMonitor.isConstruct"></a>
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { IdleMonitor } from '@mavogel/cdk-vscode-server'
|
|
71
|
+
|
|
72
|
+
IdleMonitor.isConstruct(x: any)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Checks if `x` is a construct.
|
|
76
|
+
|
|
77
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
78
|
+
instances, even when the construct library is symlinked.
|
|
79
|
+
|
|
80
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
81
|
+
disk are seen as independent, completely different libraries. As a
|
|
82
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
83
|
+
is seen as a different class, and an instance of one class will not test as
|
|
84
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
85
|
+
like this, but users may manually symlink construct libraries together or
|
|
86
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
87
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
88
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
89
|
+
this type-testing method instead.
|
|
90
|
+
|
|
91
|
+
###### `x`<sup>Required</sup> <a name="x" id="@mavogel/cdk-vscode-server.IdleMonitor.isConstruct.parameter.x"></a>
|
|
92
|
+
|
|
93
|
+
- *Type:* any
|
|
94
|
+
|
|
95
|
+
Any object.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
100
|
+
|
|
101
|
+
| **Name** | **Type** | **Description** |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
104
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor.property.function">function</a></code> | <code>aws-cdk-lib.aws_lambda.Function</code> | The Lambda function that performs idle monitoring. |
|
|
105
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor.property.scheduleRule">scheduleRule</a></code> | <code>aws-cdk-lib.aws_events.Rule</code> | The EventBridge rule that triggers idle monitoring checks. |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
##### `node`<sup>Required</sup> <a name="node" id="@mavogel/cdk-vscode-server.IdleMonitor.property.node"></a>
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
public readonly node: Node;
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- *Type:* constructs.Node
|
|
116
|
+
|
|
117
|
+
The tree node.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
##### `function`<sup>Required</sup> <a name="function" id="@mavogel/cdk-vscode-server.IdleMonitor.property.function"></a>
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
public readonly function: Function;
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
- *Type:* aws-cdk-lib.aws_lambda.Function
|
|
128
|
+
|
|
129
|
+
The Lambda function that performs idle monitoring.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
##### `scheduleRule`<sup>Required</sup> <a name="scheduleRule" id="@mavogel/cdk-vscode-server.IdleMonitor.property.scheduleRule"></a>
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
public readonly scheduleRule: Rule;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
- *Type:* aws-cdk-lib.aws_events.Rule
|
|
140
|
+
|
|
141
|
+
The EventBridge rule that triggers idle monitoring checks.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### StatusCheckApi <a name="StatusCheckApi" id="@mavogel/cdk-vscode-server.StatusCheckApi"></a>
|
|
147
|
+
|
|
148
|
+
API Gateway endpoint for checking instance status, used by resume page for polling.
|
|
149
|
+
|
|
150
|
+
#### Initializers <a name="Initializers" id="@mavogel/cdk-vscode-server.StatusCheckApi.Initializer"></a>
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { StatusCheckApi } from '@mavogel/cdk-vscode-server'
|
|
154
|
+
|
|
155
|
+
new StatusCheckApi(scope: Construct, id: string, props: StatusCheckApiProps)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
| **Name** | **Type** | **Description** |
|
|
159
|
+
| --- | --- | --- |
|
|
160
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
161
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
162
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.Initializer.parameter.props">props</a></code> | <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApiProps">StatusCheckApiProps</a></code> | *No description.* |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@mavogel/cdk-vscode-server.StatusCheckApi.Initializer.parameter.scope"></a>
|
|
167
|
+
|
|
168
|
+
- *Type:* constructs.Construct
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
##### `id`<sup>Required</sup> <a name="id" id="@mavogel/cdk-vscode-server.StatusCheckApi.Initializer.parameter.id"></a>
|
|
173
|
+
|
|
174
|
+
- *Type:* string
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
##### `props`<sup>Required</sup> <a name="props" id="@mavogel/cdk-vscode-server.StatusCheckApi.Initializer.parameter.props"></a>
|
|
179
|
+
|
|
180
|
+
- *Type:* <a href="#@mavogel/cdk-vscode-server.StatusCheckApiProps">StatusCheckApiProps</a>
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
185
|
+
|
|
186
|
+
| **Name** | **Description** |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
##### `toString` <a name="toString" id="@mavogel/cdk-vscode-server.StatusCheckApi.toString"></a>
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
public toString(): string
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Returns a string representation of this construct.
|
|
199
|
+
|
|
200
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
201
|
+
|
|
202
|
+
| **Name** | **Description** |
|
|
203
|
+
| --- | --- |
|
|
204
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
##### `isConstruct` <a name="isConstruct" id="@mavogel/cdk-vscode-server.StatusCheckApi.isConstruct"></a>
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
import { StatusCheckApi } from '@mavogel/cdk-vscode-server'
|
|
212
|
+
|
|
213
|
+
StatusCheckApi.isConstruct(x: any)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Checks if `x` is a construct.
|
|
217
|
+
|
|
218
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
219
|
+
instances, even when the construct library is symlinked.
|
|
220
|
+
|
|
221
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
222
|
+
disk are seen as independent, completely different libraries. As a
|
|
223
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
224
|
+
is seen as a different class, and an instance of one class will not test as
|
|
225
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
226
|
+
like this, but users may manually symlink construct libraries together or
|
|
227
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
228
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
229
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
230
|
+
this type-testing method instead.
|
|
231
|
+
|
|
232
|
+
###### `x`<sup>Required</sup> <a name="x" id="@mavogel/cdk-vscode-server.StatusCheckApi.isConstruct.parameter.x"></a>
|
|
233
|
+
|
|
234
|
+
- *Type:* any
|
|
235
|
+
|
|
236
|
+
Any object.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
241
|
+
|
|
242
|
+
| **Name** | **Type** | **Description** |
|
|
243
|
+
| --- | --- | --- |
|
|
244
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
245
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.property.api">api</a></code> | <code>aws-cdk-lib.aws_apigateway.RestApi</code> | The API Gateway REST API. |
|
|
246
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.property.apiUrl">apiUrl</a></code> | <code>string</code> | The URL of the status check API endpoint. |
|
|
247
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApi.property.function">function</a></code> | <code>aws-cdk-lib.aws_lambda.Function</code> | The Lambda function that handles status check requests. |
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
##### `node`<sup>Required</sup> <a name="node" id="@mavogel/cdk-vscode-server.StatusCheckApi.property.node"></a>
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
public readonly node: Node;
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
- *Type:* constructs.Node
|
|
258
|
+
|
|
259
|
+
The tree node.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
##### `api`<sup>Required</sup> <a name="api" id="@mavogel/cdk-vscode-server.StatusCheckApi.property.api"></a>
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
public readonly api: RestApi;
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
- *Type:* aws-cdk-lib.aws_apigateway.RestApi
|
|
270
|
+
|
|
271
|
+
The API Gateway REST API.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
##### `apiUrl`<sup>Required</sup> <a name="apiUrl" id="@mavogel/cdk-vscode-server.StatusCheckApi.property.apiUrl"></a>
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
public readonly apiUrl: string;
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
- *Type:* string
|
|
282
|
+
|
|
283
|
+
The URL of the status check API endpoint.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
##### `function`<sup>Required</sup> <a name="function" id="@mavogel/cdk-vscode-server.StatusCheckApi.property.function"></a>
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
public readonly function: Function;
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
- *Type:* aws-cdk-lib.aws_lambda.Function
|
|
294
|
+
|
|
295
|
+
The Lambda function that handles status check requests.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
|
|
5
300
|
### VSCodeServer <a name="VSCodeServer" id="@mavogel/cdk-vscode-server.VSCodeServer"></a>
|
|
6
301
|
|
|
7
302
|
VSCodeServer - spin it up in under 10 minutes.
|
|
@@ -102,7 +397,9 @@ Any object.
|
|
|
102
397
|
| --- | --- | --- |
|
|
103
398
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServer.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
104
399
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServer.property.domainName">domainName</a></code> | <code>string</code> | The name of the domain the server is reachable. |
|
|
400
|
+
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServer.property.instance">instance</a></code> | <code>aws-cdk-lib.aws_ec2.IInstance</code> | The EC2 instance running VS Code Server. |
|
|
105
401
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServer.property.password">password</a></code> | <code>string</code> | The password to login to the server. |
|
|
402
|
+
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServer.property.idleMonitor">idleMonitor</a></code> | <code><a href="#@mavogel/cdk-vscode-server.IdleMonitor">IdleMonitor</a></code> | The IdleMonitor construct (only present if enableAutoStop is true). |
|
|
106
403
|
|
|
107
404
|
---
|
|
108
405
|
|
|
@@ -130,6 +427,18 @@ The name of the domain the server is reachable.
|
|
|
130
427
|
|
|
131
428
|
---
|
|
132
429
|
|
|
430
|
+
##### `instance`<sup>Required</sup> <a name="instance" id="@mavogel/cdk-vscode-server.VSCodeServer.property.instance"></a>
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
public readonly instance: IInstance;
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
- *Type:* aws-cdk-lib.aws_ec2.IInstance
|
|
437
|
+
|
|
438
|
+
The EC2 instance running VS Code Server.
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
133
442
|
##### `password`<sup>Required</sup> <a name="password" id="@mavogel/cdk-vscode-server.VSCodeServer.property.password"></a>
|
|
134
443
|
|
|
135
444
|
```typescript
|
|
@@ -142,9 +451,155 @@ The password to login to the server.
|
|
|
142
451
|
|
|
143
452
|
---
|
|
144
453
|
|
|
454
|
+
##### `idleMonitor`<sup>Optional</sup> <a name="idleMonitor" id="@mavogel/cdk-vscode-server.VSCodeServer.property.idleMonitor"></a>
|
|
455
|
+
|
|
456
|
+
```typescript
|
|
457
|
+
public readonly idleMonitor: IdleMonitor;
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
- *Type:* <a href="#@mavogel/cdk-vscode-server.IdleMonitor">IdleMonitor</a>
|
|
461
|
+
|
|
462
|
+
The IdleMonitor construct (only present if enableAutoStop is true).
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
145
466
|
|
|
146
467
|
## Structs <a name="Structs" id="Structs"></a>
|
|
147
468
|
|
|
469
|
+
### IdleMonitorProps <a name="IdleMonitorProps" id="@mavogel/cdk-vscode-server.IdleMonitorProps"></a>
|
|
470
|
+
|
|
471
|
+
Props for IdleMonitor construct.
|
|
472
|
+
|
|
473
|
+
#### Initializer <a name="Initializer" id="@mavogel/cdk-vscode-server.IdleMonitorProps.Initializer"></a>
|
|
474
|
+
|
|
475
|
+
```typescript
|
|
476
|
+
import { IdleMonitorProps } from '@mavogel/cdk-vscode-server'
|
|
477
|
+
|
|
478
|
+
const idleMonitorProps: IdleMonitorProps = { ... }
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
482
|
+
|
|
483
|
+
| **Name** | **Type** | **Description** |
|
|
484
|
+
| --- | --- | --- |
|
|
485
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitorProps.property.distribution">distribution</a></code> | <code>aws-cdk-lib.aws_cloudfront.IDistribution</code> | The CloudFront distribution to monitor for activity. |
|
|
486
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitorProps.property.idleTimeoutMinutes">idleTimeoutMinutes</a></code> | <code>number</code> | Number of minutes of inactivity before stopping the instance. |
|
|
487
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitorProps.property.instance">instance</a></code> | <code>aws-cdk-lib.aws_ec2.IInstance</code> | The EC2 instance to monitor. |
|
|
488
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitorProps.property.checkIntervalMinutes">checkIntervalMinutes</a></code> | <code>number</code> | How often to check for idle activity (in minutes). |
|
|
489
|
+
| <code><a href="#@mavogel/cdk-vscode-server.IdleMonitorProps.property.skipStatusChecks">skipStatusChecks</a></code> | <code>boolean</code> | Skip instance status checks before stopping When true, IdleMonitor will stop idle instances even if status checks haven't passed This is useful for integration tests where status check initialization time exceeds test timeout limits. |
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
##### `distribution`<sup>Required</sup> <a name="distribution" id="@mavogel/cdk-vscode-server.IdleMonitorProps.property.distribution"></a>
|
|
494
|
+
|
|
495
|
+
```typescript
|
|
496
|
+
public readonly distribution: IDistribution;
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
- *Type:* aws-cdk-lib.aws_cloudfront.IDistribution
|
|
500
|
+
|
|
501
|
+
The CloudFront distribution to monitor for activity.
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
##### `idleTimeoutMinutes`<sup>Required</sup> <a name="idleTimeoutMinutes" id="@mavogel/cdk-vscode-server.IdleMonitorProps.property.idleTimeoutMinutes"></a>
|
|
506
|
+
|
|
507
|
+
```typescript
|
|
508
|
+
public readonly idleTimeoutMinutes: number;
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
- *Type:* number
|
|
512
|
+
|
|
513
|
+
Number of minutes of inactivity before stopping the instance.
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
##### `instance`<sup>Required</sup> <a name="instance" id="@mavogel/cdk-vscode-server.IdleMonitorProps.property.instance"></a>
|
|
518
|
+
|
|
519
|
+
```typescript
|
|
520
|
+
public readonly instance: IInstance;
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
- *Type:* aws-cdk-lib.aws_ec2.IInstance
|
|
524
|
+
|
|
525
|
+
The EC2 instance to monitor.
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
##### `checkIntervalMinutes`<sup>Optional</sup> <a name="checkIntervalMinutes" id="@mavogel/cdk-vscode-server.IdleMonitorProps.property.checkIntervalMinutes"></a>
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
public readonly checkIntervalMinutes: number;
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
- *Type:* number
|
|
536
|
+
- *Default:* 5 - Check every 5 minutes
|
|
537
|
+
|
|
538
|
+
How often to check for idle activity (in minutes).
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
##### `skipStatusChecks`<sup>Optional</sup> <a name="skipStatusChecks" id="@mavogel/cdk-vscode-server.IdleMonitorProps.property.skipStatusChecks"></a>
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
public readonly skipStatusChecks: boolean;
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
- *Type:* boolean
|
|
549
|
+
- *Default:* false
|
|
550
|
+
|
|
551
|
+
Skip instance status checks before stopping When true, IdleMonitor will stop idle instances even if status checks haven't passed This is useful for integration tests where status check initialization time exceeds test timeout limits.
|
|
552
|
+
|
|
553
|
+
WARNING: For testing only - in production, you should wait for status checks
|
|
554
|
+
to pass before stopping instances
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
### StatusCheckApiProps <a name="StatusCheckApiProps" id="@mavogel/cdk-vscode-server.StatusCheckApiProps"></a>
|
|
559
|
+
|
|
560
|
+
Props for StatusCheckApi construct.
|
|
561
|
+
|
|
562
|
+
#### Initializer <a name="Initializer" id="@mavogel/cdk-vscode-server.StatusCheckApiProps.Initializer"></a>
|
|
563
|
+
|
|
564
|
+
```typescript
|
|
565
|
+
import { StatusCheckApiProps } from '@mavogel/cdk-vscode-server'
|
|
566
|
+
|
|
567
|
+
const statusCheckApiProps: StatusCheckApiProps = { ... }
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
571
|
+
|
|
572
|
+
| **Name** | **Type** | **Description** |
|
|
573
|
+
| --- | --- | --- |
|
|
574
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApiProps.property.instance">instance</a></code> | <code>aws-cdk-lib.aws_ec2.IInstance</code> | The EC2 instance to check status for. |
|
|
575
|
+
| <code><a href="#@mavogel/cdk-vscode-server.StatusCheckApiProps.property.stateTable">stateTable</a></code> | <code>aws-cdk-lib.aws_dynamodb.ITable</code> | DynamoDB table for tracking instance state. |
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
##### `instance`<sup>Required</sup> <a name="instance" id="@mavogel/cdk-vscode-server.StatusCheckApiProps.property.instance"></a>
|
|
580
|
+
|
|
581
|
+
```typescript
|
|
582
|
+
public readonly instance: IInstance;
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
- *Type:* aws-cdk-lib.aws_ec2.IInstance
|
|
586
|
+
|
|
587
|
+
The EC2 instance to check status for.
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
##### `stateTable`<sup>Required</sup> <a name="stateTable" id="@mavogel/cdk-vscode-server.StatusCheckApiProps.property.stateTable"></a>
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
public readonly stateTable: ITable;
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
- *Type:* aws-cdk-lib.aws_dynamodb.ITable
|
|
598
|
+
|
|
599
|
+
DynamoDB table for tracking instance state.
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
148
603
|
### VSCodeServerProps <a name="VSCodeServerProps" id="@mavogel/cdk-vscode-server.VSCodeServerProps"></a>
|
|
149
604
|
|
|
150
605
|
Properties for the VSCodeServer construct.
|
|
@@ -168,14 +623,18 @@ const vSCodeServerProps: VSCodeServerProps = { ... }
|
|
|
168
623
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.devServerBasePath">devServerBasePath</a></code> | <code>string</code> | Base path for the application to be added to Nginx sites-available list. |
|
|
169
624
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.devServerPort">devServerPort</a></code> | <code>number</code> | Port for the DevServer. |
|
|
170
625
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.domainName">domainName</a></code> | <code>string</code> | Custom domain name for the VS Code server When provided, creates a CloudFront distribution with this domain name and sets up Route53 A record pointing to the distribution. |
|
|
626
|
+
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.enableAutoStop">enableAutoStop</a></code> | <code>boolean</code> | Enable automatic instance stop when idle Monitors CloudFront metrics and stops the EC2 instance after specified idle time. |
|
|
171
627
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.homeFolder">homeFolder</a></code> | <code>string</code> | Folder to open in VS Code server. |
|
|
172
628
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.hostedZoneId">hostedZoneId</a></code> | <code>string</code> | Route53 hosted zone ID for the domain Required when using autoCreateCertificate If not provided, will attempt to lookup hosted zone from domain name. |
|
|
629
|
+
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.idleCheckIntervalMinutes">idleCheckIntervalMinutes</a></code> | <code>number</code> | How often to check for idle activity (in minutes) Only applies when enableAutoStop is true. |
|
|
630
|
+
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.idleTimeoutMinutes">idleTimeoutMinutes</a></code> | <code>number</code> | Minutes of inactivity before stopping the instance Only applies when enableAutoStop is true. |
|
|
173
631
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.instanceClass">instanceClass</a></code> | <code>aws-cdk-lib.aws_ec2.InstanceClass</code> | VSCode Server EC2 instance class. |
|
|
174
632
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.instanceCpuArchitecture">instanceCpuArchitecture</a></code> | <code><a href="#@mavogel/cdk-vscode-server.LinuxArchitectureType">LinuxArchitectureType</a></code> | VSCode Server EC2 cpu architecture for the operating system. |
|
|
175
633
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.instanceName">instanceName</a></code> | <code>string</code> | VSCode Server EC2 instance name. |
|
|
176
634
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.instanceOperatingSystem">instanceOperatingSystem</a></code> | <code><a href="#@mavogel/cdk-vscode-server.LinuxFlavorType">LinuxFlavorType</a></code> | VSCode Server EC2 operating system. |
|
|
177
635
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.instanceSize">instanceSize</a></code> | <code>aws-cdk-lib.aws_ec2.InstanceSize</code> | VSCode Server EC2 instance size. |
|
|
178
636
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.instanceVolumeSize">instanceVolumeSize</a></code> | <code>number</code> | VSCode Server EC2 instance volume size in GB. |
|
|
637
|
+
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.skipStatusChecks">skipStatusChecks</a></code> | <code>boolean</code> | Skip instance status checks in IdleMonitor When true, IdleMonitor will stop idle instances even if status checks haven't passed This is useful for integration tests where status check initialization time exceeds the test timeout limits. |
|
|
179
638
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.vscodePassword">vscodePassword</a></code> | <code>string</code> | Password for VSCode Server. |
|
|
180
639
|
| <code><a href="#@mavogel/cdk-vscode-server.VSCodeServerProps.property.vscodeUser">vscodeUser</a></code> | <code>string</code> | UserName for VSCode Server. |
|
|
181
640
|
|
|
@@ -272,6 +731,19 @@ Custom domain name for the VS Code server When provided, creates a CloudFront di
|
|
|
272
731
|
|
|
273
732
|
---
|
|
274
733
|
|
|
734
|
+
##### `enableAutoStop`<sup>Optional</sup> <a name="enableAutoStop" id="@mavogel/cdk-vscode-server.VSCodeServerProps.property.enableAutoStop"></a>
|
|
735
|
+
|
|
736
|
+
```typescript
|
|
737
|
+
public readonly enableAutoStop: boolean;
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
- *Type:* boolean
|
|
741
|
+
- *Default:* false
|
|
742
|
+
|
|
743
|
+
Enable automatic instance stop when idle Monitors CloudFront metrics and stops the EC2 instance after specified idle time.
|
|
744
|
+
|
|
745
|
+
---
|
|
746
|
+
|
|
275
747
|
##### `homeFolder`<sup>Optional</sup> <a name="homeFolder" id="@mavogel/cdk-vscode-server.VSCodeServerProps.property.homeFolder"></a>
|
|
276
748
|
|
|
277
749
|
```typescript
|
|
@@ -298,6 +770,32 @@ Route53 hosted zone ID for the domain Required when using autoCreateCertificate
|
|
|
298
770
|
|
|
299
771
|
---
|
|
300
772
|
|
|
773
|
+
##### `idleCheckIntervalMinutes`<sup>Optional</sup> <a name="idleCheckIntervalMinutes" id="@mavogel/cdk-vscode-server.VSCodeServerProps.property.idleCheckIntervalMinutes"></a>
|
|
774
|
+
|
|
775
|
+
```typescript
|
|
776
|
+
public readonly idleCheckIntervalMinutes: number;
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
- *Type:* number
|
|
780
|
+
- *Default:* 5 - Check every 5 minutes
|
|
781
|
+
|
|
782
|
+
How often to check for idle activity (in minutes) Only applies when enableAutoStop is true.
|
|
783
|
+
|
|
784
|
+
---
|
|
785
|
+
|
|
786
|
+
##### `idleTimeoutMinutes`<sup>Optional</sup> <a name="idleTimeoutMinutes" id="@mavogel/cdk-vscode-server.VSCodeServerProps.property.idleTimeoutMinutes"></a>
|
|
787
|
+
|
|
788
|
+
```typescript
|
|
789
|
+
public readonly idleTimeoutMinutes: number;
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
- *Type:* number
|
|
793
|
+
- *Default:* 30
|
|
794
|
+
|
|
795
|
+
Minutes of inactivity before stopping the instance Only applies when enableAutoStop is true.
|
|
796
|
+
|
|
797
|
+
---
|
|
798
|
+
|
|
301
799
|
##### `instanceClass`<sup>Optional</sup> <a name="instanceClass" id="@mavogel/cdk-vscode-server.VSCodeServerProps.property.instanceClass"></a>
|
|
302
800
|
|
|
303
801
|
```typescript
|
|
@@ -376,6 +874,22 @@ VSCode Server EC2 instance volume size in GB.
|
|
|
376
874
|
|
|
377
875
|
---
|
|
378
876
|
|
|
877
|
+
##### `skipStatusChecks`<sup>Optional</sup> <a name="skipStatusChecks" id="@mavogel/cdk-vscode-server.VSCodeServerProps.property.skipStatusChecks"></a>
|
|
878
|
+
|
|
879
|
+
```typescript
|
|
880
|
+
public readonly skipStatusChecks: boolean;
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
- *Type:* boolean
|
|
884
|
+
- *Default:* false
|
|
885
|
+
|
|
886
|
+
Skip instance status checks in IdleMonitor When true, IdleMonitor will stop idle instances even if status checks haven't passed This is useful for integration tests where status check initialization time exceeds the test timeout limits.
|
|
887
|
+
|
|
888
|
+
WARNING: For testing only - in production, you should wait for status checks
|
|
889
|
+
to pass before stopping instances to avoid stopping unhealthy instances
|
|
890
|
+
|
|
891
|
+
---
|
|
892
|
+
|
|
379
893
|
##### `vscodePassword`<sup>Optional</sup> <a name="vscodePassword" id="@mavogel/cdk-vscode-server.VSCodeServerProps.property.vscodePassword"></a>
|
|
380
894
|
|
|
381
895
|
```typescript
|
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ we implement new features. Therefore make sure you use an exact version in your
|
|
|
31
31
|
- ๐ **Best Practice Setup**: Set up with [projen](https://projen.io/) and a [single configuration file](./.projenrc.ts) to keep your changes centralized.
|
|
32
32
|
- ๐คนโโ๏ธ **Pre-installed packages**: Besides the [vscode](https://code.visualstudio.com/) server, other tools and software packages such as `git`, `docker`, `awscli` `nodejs` and `python` are pre-installed on the EC2 instance.
|
|
33
33
|
- ๐ **Custom Domain Support**: Use your own domain name with automatic ACM certificate creation and Route53 DNS configuration, or bring your existing certificate.
|
|
34
|
+
- ๐ฐ **Auto-Stop**: Automatically stop EC2 instances after inactivity with Elastic IP retention - save up to 75% on costs for development environments
|
|
34
35
|
- ๐๏ธ **Extensibility**: Pass in properties to the construct, which start with `additional*`. They allow you to extend the configuration to your needs. There are more to come...
|
|
35
36
|
|
|
36
37
|
## Usage
|
|
@@ -166,6 +167,62 @@ For complete examples, see [examples/custom-domain/main.ts](./examples/custom-do
|
|
|
166
167
|
> [!Important]
|
|
167
168
|
> There are issues with copy pasting into the VSCode terminal within the Firefox browser (2025-01-12)
|
|
168
169
|
|
|
170
|
+
### Auto-Stop Configuration
|
|
171
|
+
|
|
172
|
+
Save up to 75% on costs by automatically stopping EC2 instances when idle:
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
new VSCodeServer(this, 'vscode', {
|
|
176
|
+
enableAutoStop: true, // Enable auto-stop feature
|
|
177
|
+
idleTimeoutMinutes: 30, // Stop after 30 minutes of no activity (default)
|
|
178
|
+
idleCheckIntervalMinutes: 5, // Check for idle activity every 5 minutes (default)
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**How it works:**
|
|
183
|
+
1. **Idle Detection**: Monitors CloudFront request metrics at configured intervals (default: every 5 minutes)
|
|
184
|
+
2. **Auto-Stop**: Stops the EC2 instance after the configured idle timeout when no requests are detected
|
|
185
|
+
3. **Static IP**: Allocates an Elastic IP to maintain a consistent public IP address across stop/start cycles
|
|
186
|
+
4. **Manual Resume**: Users can manually start the instance via AWS Console or CLI when needed
|
|
187
|
+
|
|
188
|
+
**Cost Savings Example:**
|
|
189
|
+
- **Without auto-stop**: m7g.xlarge running 24/7 = ~$120/month
|
|
190
|
+
- **With auto-stop** (8 hours/day, 5 days/week): ~$30/month
|
|
191
|
+
- **Savings**: ~$90/month (75% reduction)
|
|
192
|
+
|
|
193
|
+
**Additional costs:**
|
|
194
|
+
- Elastic IP (allocated): ~$3.65/month
|
|
195
|
+
- Lambda function (IdleMonitor): ~$0.10/month
|
|
196
|
+
- EventBridge rule: Negligible
|
|
197
|
+
- **Net savings**: ~$86/month per instance
|
|
198
|
+
|
|
199
|
+
**Architecture Components:**
|
|
200
|
+
- Elastic IP for consistent public addressing
|
|
201
|
+
- EventBridge rule triggering idle monitoring at configured intervals
|
|
202
|
+
- IdleMonitor Lambda function checking CloudWatch metrics for request activity
|
|
203
|
+
- CloudWatch metrics from CloudFront distribution
|
|
204
|
+
|
|
205
|
+
**Integration Testing:**
|
|
206
|
+
|
|
207
|
+
The stop-on-idle functionality includes comprehensive integration tests (`integ-tests/integ.stop-on-idle.ts`) that verify the complete workflow:
|
|
208
|
+
|
|
209
|
+
1. **Phase 1 - Verify Auto-Stop**: Waits for the instance to automatically stop after the configured idle timeout
|
|
210
|
+
2. **Phase 2 - Disable IdleMonitor**: Disables the EventBridge rule to prevent the instance from being stopped again during testing
|
|
211
|
+
3. **Phase 3 - Start Instance**: Starts the stopped instance and waits for it to reach the running state
|
|
212
|
+
4. **Phase 4 - Verify Login**: Confirms that VS Code Server is accessible through CloudFront after the instance has been restarted
|
|
213
|
+
|
|
214
|
+
This 4-phase test ensures that:
|
|
215
|
+
- Idle detection works correctly based on CloudWatch metrics
|
|
216
|
+
- Instance stops automatically when no activity is detected
|
|
217
|
+
- Instance can be successfully restarted after being stopped
|
|
218
|
+
- VS Code Server remains accessible after stop/start cycles
|
|
219
|
+
- Elastic IP maintains connectivity across state changes
|
|
220
|
+
|
|
221
|
+
Run integration tests with:
|
|
222
|
+
```bash
|
|
223
|
+
npm run integ-test
|
|
224
|
+
```
|
|
225
|
+
|
|
169
226
|
## Solution Design
|
|
170
227
|
|
|
171
228
|
<details>
|