@guardian/cdk 64.3.0 → 64.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/CHANGELOG.md ADDED
@@ -0,0 +1,1591 @@
1
+ # @guardian/cdk
2
+
3
+ ## 64.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 140f1f5: Explicitly configure ECS tasks in `GuLoadBalancedAppExperimental` to use ARM64 (Graviton) and Linux.
8
+ This configuration matches our EC2 workloads.
9
+
10
+ ### Patch Changes
11
+
12
+ - b3108b1: Bump js-yaml from 4.3.0 to 4.3.1
13
+
14
+ ## 64.3.0
15
+
16
+ ### Minor Changes
17
+
18
+ - b13cdba: Changes the stem of the logical ID for the target group created for ECS in the `GuLoadBalancedAppExperimental` pattern. This results in a more a slightly more human-readable name.
19
+
20
+ For example, say we have a CloudFormation stack called `deploy-CODE-cdk-playground`, previously the target group name would be `deploy-EcsTar-123456123456`, now it will be `deploy-Cdkpl-123456123456`.
21
+
22
+ NOTE: As this is a change to an experimental pattern, it is not considered a breaking change even though it results in recreating a [stateful resource](../docs/stateful-resources.md).
23
+
24
+ ### Patch Changes
25
+
26
+ - 51bb82e: Update aws-cdk to ^2.1135.0, aws-cdk-lib to ^2.263.0, constructs to ^10.8.1
27
+ - b5ef901: Fix `new` command so generated projects pass their own lint check. The `eslint --fix` step passed `"lib/** bin/**"` as a single argument to `spawn` (with `shell: false`), so the globs never matched and no autofix ran. The globs are now passed as separate arguments. Additionally, generated import statements now place Node built-in modules (e.g. `path`) before third-party imports to satisfy the `import/order` rule.
28
+
29
+ ## 64.2.0
30
+
31
+ ### Minor Changes
32
+
33
+ - ef75d0c: Add STACK, STAGE, APP environment variables to default container of ECS cluster provisioned by `GuLoadBalancedAppExperimental`.
34
+
35
+ ### Patch Changes
36
+
37
+ - 0a25fcf: Update js-yaml from 4.1.1 to 4.3.0
38
+ - 4a85881: Explicitly add the `App` tag to all resources created by `GuLoadBalancedAppExperimental`. Namely, `App` is added to:
39
+ - `AWS::ECS::Cluster`
40
+ - `AWS::ECS::TaskDefinition`
41
+ - `AWS::ECS::Service`
42
+
43
+ Previously, these resources implicitly inherited the `App` tag of the parent CloudFormation stack.
44
+ The CloudFormation's `App` tag is implicitly set by Riff-Raff via the contents of the `riff-raff.yaml` configuration.
45
+
46
+ ## 64.1.0
47
+
48
+ ### Minor Changes
49
+
50
+ - c038df4: Adds deterministic routing rules for EC2 to ECS migrations.
51
+
52
+ Allow callers to force a request to a specific target group
53
+ using an HTTP header rather than relying on the default weighted routing.
54
+
55
+ Example usage:
56
+
57
+ ```
58
+ curl -i -H 'X-Gu-Target-Group: ecs' https://cdk-playground.code.dev-gutools.co.uk
59
+ ```
60
+
61
+ ## 64.0.0
62
+
63
+ ### Major Changes
64
+
65
+ - d880b52: Implement `GuParameterStoreReadPolicy` as a singleton to support `GuLoadBalancedAppExperimental` instantiating it once for the EC2 app and once for the ECS app.
66
+ The result is a single `AWS::IAM::Policy` resource in the CloudFormation template, which is attached to both the EC2 and ECS roles, keeping the diff small.
67
+
68
+ A [GitHub search](https://github.com/search?q=org%3Aguardian+GuParameterStoreReadPolicy+NOT+repo%3Aguardian%2Fcdk++NOT+is%3Aarchived&type=code) shows `GuParameterStoreReadPolicy` is never directly instantiated by clients.
69
+
70
+ - 348cc70: Removes the `roleConfiguration` property when instantiating a `GuEc2App` or `GuLoadBalancedAppExperimental` in favour of declaring `additionalPolicies` as a top level property.
71
+ As a consequence, it is no longer possible to opt-out of log shipping with `withoutLogShipping`; the IAM Policy will always grant PutRecord to the account's logging Kinesis stream.
72
+
73
+ To migrate, remove the `roleConfiguration` property and move any policies declared in `roleConfiguration.additionalPolicies` to the top level `additionalPolicies` property:
74
+
75
+ ```ts
76
+ // Before
77
+ new GuEc2App(this, {
78
+ // other props
79
+ roleConfiguration: {
80
+ additionalPolicies: [
81
+ new GuAllowPolicy(this, "AllowPolicyCloudwatchLogs", {
82
+ actions: ["cloudwatch:*", "logs:*"],
83
+ resources: ["*"],
84
+ }),
85
+ new GuAllowPolicy(this, "AllowPolicyDescribeDecryptKms", {
86
+ actions: ["kms:Decrypt", "kms:DescribeKey"],
87
+ resources: [`arn:aws:kms:${region}:${account}:FrontendConfigKey`],
88
+ }),
89
+ ],
90
+ },
91
+ });
92
+
93
+ // After
94
+ new GuEc2App(this, {
95
+ // other props
96
+ additionalPolicies: [
97
+ new GuAllowPolicy(this, "AllowPolicyCloudwatchLogs", {
98
+ actions: ["cloudwatch:*", "logs:*"],
99
+ resources: ["*"],
100
+ }),
101
+ new GuAllowPolicy(this, "AllowPolicyDescribeDecryptKms", {
102
+ actions: ["kms:Decrypt", "kms:DescribeKey"],
103
+ resources: [`arn:aws:kms:${region}:${account}:FrontendConfigKey`],
104
+ }),
105
+ ],
106
+ });
107
+ ```
108
+
109
+ A [GitHub search](https://github.com/search?q=org%3Aguardian+withoutLogShipping+NOT+repo%3Aguardian%2Fcdk++NOT+is%3Aarchived+NOT+repo%3Aguardian%2Faws-account-setup&type=code)
110
+ shows the `withoutLogShipping` property is never set by clients when instantiating a `GuEc2App` or `GuLoadBalancedAppExperimental`.
111
+
112
+ ### Minor Changes
113
+
114
+ - b97db0e: Apply `additionalPolicies` to ECS task role created for `GuLoadBalancedAppExperimental` so the ECS task role inherits any custom permissions needed to run the application.
115
+ These are already applied to the EC2 instance role.
116
+
117
+ ## 63.6.2
118
+
119
+ ### Patch Changes
120
+
121
+ - 96faca2: Adjust validation of `targetGroupWeights` property in `GuLoadBalancedAppExperimental`.
122
+
123
+ Previously, we asserted the sum total weight was 999. From the [AWS docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-elasticloadbalancingv2-listener-targetgrouptuple.html), each ALB target group weight must be between 0 and 999.
124
+ From there, AWS will work out the percentage of traffic to send to each target group.
125
+
126
+ This creates a simpler interface as, for example, to route 1% of traffic to ECS we can:
127
+
128
+ ```ts
129
+ targetGroupWeights: {
130
+ ecs: 1,
131
+ ec2: 99
132
+ }
133
+ ```
134
+
135
+ ## 63.6.1
136
+
137
+ ### Patch Changes
138
+
139
+ - 1486ada: Adds s3:AbortMultipartUpload to GuFastlyLogsIamRole
140
+
141
+ ## 63.6.0
142
+
143
+ ### Minor Changes
144
+
145
+ - 67017ed: Support pulling images across accounts
146
+
147
+ Currently, we have a central ECR registry in the DeployTools account.
148
+ This change updates how we reference an image, by using the ARN of the registry to support running an ECS service in another account.
149
+
150
+ ## 63.5.1
151
+
152
+ ### Patch Changes
153
+
154
+ - 636aad0: fix(ecs): Apply custom healthcheck settings to ECS target group too
155
+
156
+ ## 63.5.0
157
+
158
+ ### Minor Changes
159
+
160
+ - 991eed0: Add support for EC2 versioned deployments to GuLoadBalancedAppExperimental
161
+
162
+ ## 63.4.0
163
+
164
+ ### Minor Changes
165
+
166
+ - 6471e19: Add new GuLoadBalancedAppExperimental pattern which supports EC2 and/or ECS
167
+
168
+ ## 63.3.1
169
+
170
+ ### Patch Changes
171
+
172
+ - b656328: Correct Riff-Raff project tag key to match the one previously introduced in https://github.com/guardian/riff-raff/pull/1374/changes: `gu:riff-raff:project`.
173
+
174
+ ## 63.3.0
175
+
176
+ ### Minor Changes
177
+
178
+ - a7726ad: Add a comment to generated `riff-raff.yaml` files for additional clarity.
179
+
180
+ ## 63.2.1
181
+
182
+ ### Patch Changes
183
+
184
+ - d2f2a3a: Update `@aws-sdk/*` dependencies.
185
+
186
+ ## 63.2.0
187
+
188
+ ### Minor Changes
189
+
190
+ - ac2348e: Fix warnings around childProcess.spawn and shell: true.
191
+
192
+ ### Patch Changes
193
+
194
+ - bc0f9b8: Bump the Cognito auth lambda runtime from `PROVIDED_AL2` (deprecated) to `PROVIDED_AL2023` in the `GuEc2App` pattern.
195
+ No client changes needed.
196
+
197
+ ## 63.1.0
198
+
199
+ ### Minor Changes
200
+
201
+ - 3b98fea: Minor improvements to the GuDeveloperPolicy class to make it more intuitive for users.
202
+ - path includes source repo name to help map the policy back from AWS to its source codebase.
203
+ - path includes stack and stage as we have nowhere else to find it and this can help with identification.
204
+ - friendlyName is now a required attribute that maps to the managed policy's description.
205
+ - The policy must have at least one statement.
206
+ - permission attribute is now called grantId to match with the corresponding Janus structure.
207
+
208
+ ## 63.0.1
209
+
210
+ ### Patch Changes
211
+
212
+ - 1ff04c8: Introduce a withoutPolicyChecks flag to GuDeveloperPolicy properties so that the check can be turned off.
213
+
214
+ Provide instructions for use of that flag in the "overbroad" action/resource error text.
215
+
216
+ This enables teams to use fully wildcarded actions and resources when needed, but also provides information in
217
+ cloudformation metadata to allow us to track the usage of that switch in order to study how often this is
218
+ needed.
219
+
220
+ ## 63.0.0
221
+
222
+ ### Major Changes
223
+
224
+ - c6e30e1: Support generating multiple `riff-raff.yaml` files. To do this, set the `riffRaffProjectName` property of a `GuStack`.
225
+ This is helpful in a few scenarios, for example if you have a singleton (INFRA) stack, and CODE/PROD application stacks.
226
+
227
+ In the following, two files will be produced:
228
+ - `/path/to/cdk.out/deploy::core-infra/riff-raff.yaml`
229
+ - `/path/to/cdk.out/deploy::my-app/riff-raff.yaml`
230
+
231
+ ```ts
232
+ class MyCoreInfraStack extends GuStack {}
233
+ class MyApplicationStack extends GuStack {}
234
+
235
+ new MyCoreInfraStack(app, "MyCoreInfra", {
236
+ stack: "deploy",
237
+ stage: "INFRA",
238
+ env: { region: "eu-west-1" },
239
+ riffRaffProjectName: "deploy::core-infra",
240
+ });
241
+
242
+ new MyApplicationStack(app, "MyApp-CODE", {
243
+ stack: "deploy",
244
+ stage: "CODE",
245
+ env: { region: "eu-west-1" },
246
+ riffRaffProjectName: "deploy::my-app",
247
+ });
248
+
249
+ new MyApplicationStack(app, "MyApp-PROD", {
250
+ stack: "deploy",
251
+ stage: "PROD",
252
+ env: { region: "eu-west-1" },
253
+ riffRaffProjectName: "deploy::my-app",
254
+ });
255
+ ```
256
+
257
+ BREAKING CHANGE: Within `RiffRaffYamlFile` the `riffRaffYaml` property has been removed.
258
+ NOTE: If you're using `GuRoot`, this change should not impact you.
259
+
260
+ To migrate, use the `configuration` property:
261
+
262
+ ```ts
263
+ // BEFORE
264
+ const app = new App();
265
+ const riffRaff = new RiffRaffYamlFile(app);
266
+ const deployments = riffRaff.riffRaffYaml.deployments;
267
+
268
+ const myStack = new MyStack(app, "my-stack", {
269
+ stack: "playground",
270
+ stage: "PROD",
271
+ env: { region: "eu-west-1" },
272
+ riffRaffProjectName: "playground::my-stack",
273
+ });
274
+
275
+ deployments.set("additional-deployment", {
276
+ type: "aws-s3",
277
+ ...
278
+ });
279
+
280
+ // AFTER
281
+ const app = new App();
282
+ const riffRaff = new RiffRaffYamlFile(app);
283
+ const { configuration } = riffRaff;
284
+
285
+ configuration.get("playground::my-stack")?.deployments.set("additional-deployment", {
286
+ type: "aws-s3",
287
+ ...
288
+ });
289
+ ```
290
+
291
+ ### Minor Changes
292
+
293
+ - 59367ec: Add optional `riffRaffProjectName` property to `GuStackProps` representing the name of the Riff-Raff project used to deploy these resources.
294
+ If provided, it is used as the value of the `gu:riff-raff-project` tag on all resources.
295
+
296
+ See also https://github.com/guardian/riffraff-platform.
297
+
298
+ ### Patch Changes
299
+
300
+ - a02c318: Correctly validate stack existence when instantiating a `RiffRaffYamlFile` to generate `riff-raff.yaml`.
301
+
302
+ Given the below set of stacks, an `Error` will now be thrown as there is a missing instance of `MyDatabaseStack` for `CODE`.
303
+
304
+ ```typescript
305
+ new MyApplicationStack(app, "App-CODE-deploy", {
306
+ env: {
307
+ region: "eu-west-1",
308
+ },
309
+ stack: "deploy",
310
+ stage: "CODE",
311
+ });
312
+ new MyApplicationStack(app, "App-PROD-deploy", {
313
+ env: {
314
+ region: "eu-west-1",
315
+ },
316
+ stack: "deploy",
317
+ stage: "PROD",
318
+ });
319
+
320
+ new MyDatabaseStack(app, "Database-PROD-deploy", {
321
+ env: {
322
+ region: "eu-west-1",
323
+ },
324
+ stack: "deploy",
325
+ stage: "PROD",
326
+ });
327
+ ```
328
+
329
+ Previously, the validation would incorrectly pass.
330
+
331
+ <details><summary>Invalid `riff-raff.yaml`</summary>
332
+ <p>
333
+
334
+ ```yaml
335
+ allowedStages:
336
+ - CODE
337
+ - PROD
338
+ deployments:
339
+ cfn-eu-west-1-deploy-my-application-stack:
340
+ type: cloud-formation
341
+ regions:
342
+ - eu-west-1
343
+ stacks:
344
+ - deploy
345
+ app: my-application-stack
346
+ contentDirectory: /private/var/folders/0_/pvjwppsx5cl19t4n6_rmm_y80000gp/T/cdk.out9xIUJu
347
+ parameters:
348
+ templateStagePaths:
349
+ CODE: App-CODE-deploy.template.json
350
+ PROD: App-PROD-deploy.template.json
351
+ cfn-eu-west-1-deploy-my-database-stack:
352
+ type: cloud-formation
353
+ regions:
354
+ - eu-west-1
355
+ stacks:
356
+ - deploy
357
+ app: my-database-stack
358
+ contentDirectory: /private/var/folders/0_/pvjwppsx5cl19t4n6_rmm_y80000gp/T/cdk.out9xIUJu
359
+ parameters:
360
+ templateStagePaths:
361
+ PROD: Database-PROD-deploy.template.json
362
+ ```
363
+
364
+ </p>
365
+ </details>
366
+
367
+ ## 62.6.1
368
+
369
+ ### Patch Changes
370
+
371
+ - 0f9611e: Correctly add `minInstancesInServiceParameters` to a generated `riff-raff.yaml` file.
372
+
373
+ The following experimental classes have an API change:
374
+ - `GuAutoScalingRollingUpdateTimeoutExperimental`
375
+ - `GuHorizontallyScalingDeploymentPropertiesExperimental`
376
+
377
+ Specifically, they are no longer implemented as singletons. This means they're now instantiated differently:
378
+
379
+ ```typescript
380
+ declare const stack: GuStack;
381
+
382
+ // Before
383
+ Aspects.of(stack).add(GuAutoScalingRollingUpdateTimeoutExperimental.getInstance(stack));
384
+ Aspects.of(stack).add(GuHorizontallyScalingDeploymentPropertiesExperimental.getInstance(stack));
385
+
386
+ // Now
387
+ Aspects.of(stack).add(new GuAutoScalingRollingUpdateTimeoutExperimental());
388
+ Aspects.of(stack).add(new GuHorizontallyScalingDeploymentPropertiesExperimental());
389
+ ```
390
+
391
+ NOTE: It is important to instantiate `GuAutoScalingRollingUpdateTimeoutExperimental` only once per `GuStack` to avoid incorrectly updating resources multiple times.
392
+ To do this, either instantiate it in the constructor of your `GuStack`. Alternatively, check if it is present in the stack's aspects before adding it:
393
+
394
+ ```typescript
395
+ declare const stack: GuStack;
396
+
397
+ const allAspects = Aspects.of(stack).all;
398
+
399
+ const maybeRollingUpdateTimeoutAspect = allAspects.find(
400
+ (_) => _ instanceof GuAutoScalingRollingUpdateTimeoutExperimental,
401
+ );
402
+ if (!maybeRollingUpdateTimeoutAspect) {
403
+ Aspects.of(stack).add(new GuAutoScalingRollingUpdateTimeoutExperimental());
404
+ }
405
+ ```
406
+
407
+ ## 62.6.0
408
+
409
+ ### Minor Changes
410
+
411
+ - 87b8f74: Remove redundant GuJanusAssumableRole now that it has been superseded by GuDeveloperPolicy. In principle a breaking change but this role is not in use anywhere so there needs to be no change to consuming code.
412
+
413
+ ### Patch Changes
414
+
415
+ - 4c43c08: Update `fast-xml-parser` and `@aws-sdk/xml-builder` transitive dependencies to address security vulnerabilities (CVE-2026-33036).
416
+
417
+ ## 62.5.4
418
+
419
+ ### Patch Changes
420
+
421
+ - d41f682: Add Aspects and Annotations to Developer Policy: Aspects and Annotations provide a mechanism for additional validation or classes. In our Gu Developer Policy objects we do not want any wildcarded actions or resources; all of these should be as tightly scoped as possible.
422
+ - 9111df3: Developer Policy has been updated to
423
+ - enforce reasonable checks that the allow policies do not provide overly wildcarded actions or resources.
424
+ - Remove the use of GuAllow and GuDeny, as they do not offer sufficient benefit for maintenance cost.
425
+
426
+ Developer Policy remains "experimental" pending some real world usage testing, but is not expected to change structure again.
427
+
428
+ ## 62.5.3
429
+
430
+ ### Patch Changes
431
+
432
+ - c573651: Update aws-cdk to ^2.1110.0, aws-cdk-lib to ^2.241.0, constructs to ^10.5.1
433
+
434
+ ## 62.5.2
435
+
436
+ ### Patch Changes
437
+
438
+ - b2f227f: Updating `@aws-sdk/*` dependencies.
439
+
440
+ ## 62.5.1
441
+
442
+ ### Patch Changes
443
+
444
+ - 6c73caa: Update aws-cdk to ^2.1108.0, aws-cdk-lib to ^2.241.0, constructs to ^10.5.1
445
+
446
+ ## 62.5.0
447
+
448
+ ### Minor Changes
449
+
450
+ - 6a41012: Remove dependency `@oclif/core`.
451
+
452
+ We were using `@oclif/core` to create a spinner with the new project CLI. See https://github.com/oclif/core/tree/main/src/ux#action.
453
+ We currently have some open vulnerabilities with `minimatch`, which `@oclif/core` adds transitively.
454
+ This change removes `@oclif/core` in favour of `console.log` statements.
455
+
456
+ ## 62.4.0
457
+
458
+ ### Minor Changes
459
+
460
+ - 62c6674: Add a class for safe instantiation of managed policies with a specific structure of path
461
+ which enables them to be discoverable.
462
+
463
+ This enables teams to define sets of permissions which are re-usable and can be used to
464
+ create credentials suitable to approach a given workload, consistent with the Principle
465
+ of Least Privilege. This is preferred to existing workflows where a wide-ranging
466
+ developer role is used.
467
+
468
+ These can be reused in multiple locations, so, for example, an EC2 instance can be given
469
+ a specific set of permissions which are also identically available for a support task.
470
+ Changing one would then change the other, ensuring encapsulation of requirements in a
471
+ single place.
472
+
473
+ ## 62.3.5
474
+
475
+ ### Patch Changes
476
+
477
+ - abf37bc: Update aws-cdk to ^2.1107.0, aws-cdk-lib to ^2.240.0, constructs to ^10.5.1
478
+ - f0c4165: Update dependencies to resolve security vulnerability CVE-2026-26996.
479
+ - 4baf9ed: Update dependencies to resolve security vulnerability CVE-2026-26278.
480
+
481
+ ## 62.3.4
482
+
483
+ ### Patch Changes
484
+
485
+ - 7d08810: Remove unnecessary npm script from new project template
486
+
487
+ ## 62.3.3
488
+
489
+ ### Patch Changes
490
+
491
+ - 7ad7ff0: Update aws-cdk to ^2.1105.0, aws-cdk-lib to ^2.238.0, constructs to ^10.4.5
492
+
493
+ ## 62.3.2
494
+
495
+ ### Patch Changes
496
+
497
+ - c35e7db: Add the option to create a WAF parameter to GuEc2App.
498
+
499
+ Various projects use WAF to protect their load balancer. This is implemented by an SSM Parameter which is picked up by WAF configuration.
500
+
501
+ Rather than have multiple projects create the param, it is now possible to simply mark the GuEc2App as WAF enabled, and the param will be created with a standard format.
502
+
503
+ ## 62.3.1
504
+
505
+ ### Patch Changes
506
+
507
+ - 0bcd45c: Update aws-cdk to ^2.1100.3, aws-cdk-lib to ^2.234.1, constructs to ^10.4.4
508
+
509
+ ## 62.3.0
510
+
511
+ ### Minor Changes
512
+
513
+ - 9d4a1d6: Move discoverability of GuJanusAssumableRole from tag to path
514
+
515
+ ### Patch Changes
516
+
517
+ - 4ad1bc1: Adds an Owner tag for the auth-lambda, so that teams auditing their Lambda functions can more easily understand who is responsible for maintaining this Lambda.
518
+
519
+ This Lambda is maintained by DevX as part of https://github.com/guardian/cognito-auth-lambdas.
520
+
521
+ If your EC2 application uses the `googleAuth` feature then you will need to update your snapshots to accept this change.
522
+
523
+ ## 62.2.1
524
+
525
+ ### Patch Changes
526
+
527
+ - 438089b: Update aws-cdk to ^2.1033.0, aws-cdk-lib to ^2.232.1, constructs to ^10.4.3
528
+
529
+ ## 62.2.0
530
+
531
+ ### Minor Changes
532
+
533
+ - c49c7a0: Add GuJanusAssumableRole construct
534
+
535
+ ## 62.1.3
536
+
537
+ ### Patch Changes
538
+
539
+ - 7c25920: Downgrade `@guardian/eslint-config` to v12.0.0 to remove `react` transitive dependency.
540
+
541
+ ## 62.1.2
542
+
543
+ ### Patch Changes
544
+
545
+ - f1fd01b: The new deployment mechanism (`GuEc2AppExperimental`) now suspends some additional ASG processes:
546
+
547
+ `AZRebalance`
548
+ `InstanceRefresh`
549
+ `ReplaceUnhealthy`
550
+ `ScheduledActions`
551
+ `HealthCheck`
552
+
553
+ https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html#process-types
554
+
555
+ This follows a recommendation from AWS and should make deployments (and rollbacks) more reliable:
556
+ https://repost.aws/knowledge-center/auto-scaling-group-rolling-updates
557
+
558
+ ## 62.1.1
559
+
560
+ ### Patch Changes
561
+
562
+ - d0ad2ec: no-op
563
+
564
+ This is a no-op release to test migration to [NPM trusted publishing](https://docs.npmjs.com/trusted-publishers).
565
+
566
+ ## 62.1.0
567
+
568
+ ### Minor Changes
569
+
570
+ - a335873: Upgrade aws sdk to v3
571
+
572
+ ## 62.0.1
573
+
574
+ ### Patch Changes
575
+
576
+ - 810a08a: Update aws-cdk to ^2.1030.0, aws-cdk-lib to ^2.219.0, constructs to ^10.4.2
577
+
578
+ ## 62.0.0
579
+
580
+ ### Major Changes
581
+
582
+ - 12be0e5: Access logging for Application Load Balancers (ALBs) is now enabled by default.
583
+
584
+ [Application Load Balancer (ALB) access logs](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html) describe, in detail, each request processed by a load balancer, including request paths and status codes.
585
+ They are helpful during incident response and are now enabled by default.
586
+
587
+ Previously users of the `GuEc2App`, `GuNodeApp`, `GuPlayApp `, `GuPlayWorkerApp` and `GuEc2AppExperimental` patterns could opt-in to this logging via the `accessLogging` property and configure the S3 prefix.
588
+
589
+ This property is now removed and replaced with a new optional boolean property `withAccessLogging` which defaults to `true`.
590
+ - When `true` the ALB will have access logs enabled, configured to write to the account's S3 bucket using a specific prefix for compatibility with the `gucdk_access_logs` database created in Athena via https://github.com/guardian/aws-account-setup.
591
+ - When `false` the [`access_logs.s3.enabled` attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-elasticloadbalancingv2-loadbalancer-loadbalancerattribute.html) is now explicitly set to `false`.
592
+
593
+ A `withAccessLogging` property is also added to the `GuApplicationLoadBalancer` construct, with the same behaviour.
594
+
595
+ NOTE: This feature requires a region to be set at the `GuStack` level, else the following error will be thrown:
596
+
597
+ > ValidationError: Region is required to enable ELBv2 access logging
598
+
599
+ Here's an example of how to set the region:
600
+
601
+ ```typescript
602
+ class MyStack extends GuStack {
603
+ constructor(scope: App, id: string, props: GuStackProps) {
604
+ super(scope, id, props);
605
+ }
606
+ }
607
+
608
+ const stackInstance = new MyStack(app, "MyStack", {
609
+ env: {
610
+ region: "eu-west-1",
611
+ },
612
+ });
613
+ ```
614
+
615
+ There are three cost areas to this feature:
616
+ - Writing to S3.
617
+
618
+ AWS absorbs these costs.
619
+
620
+ - S3 data storage.
621
+
622
+ This cost will vary depending on the volume of traffic received; more traffic, more logs. To somewhat mitigate this, the target S3 bucket has already been configured to retain logs for 14 days.
623
+
624
+ - Reading from S3 using Athena.
625
+
626
+ This cost will vary depending on the volume of logs queried.
627
+
628
+ ## 61.11.1
629
+
630
+ ### Patch Changes
631
+
632
+ - ce55193: Update aws-cdk to ^2.1029.1, aws-cdk-lib to ^2.214.0, constructs to ^10.4.2
633
+
634
+ ## 61.11.0
635
+
636
+ ### Minor Changes
637
+
638
+ - 44adc37: feat(experimental-ec2-pattern): Echo RiffRaffDeploymentId in user-data
639
+
640
+ This change adds a new CloudFormation parameter, `RiffRaffDeploymentId`, to be set by Riff-Raff during deployment (see guardian/riff-raff#1469).
641
+ This parameter is echoed out in the user-data. This means a redeployment of the same build creates a CloudFormation changeset with a new launch template.
642
+ Consequently, the running EC2 instances are cycled. This means scheduled deployments are possible.
643
+
644
+ ### Patch Changes
645
+
646
+ - 838492c: Update aws-cdk to ^2.1018.0, aws-cdk-lib to ^2.200.1, constructs to ^10.4.2
647
+ - 1e87504: Remove lodash dependencies
648
+ - 848d54f: Remove unused `RegexPattern.S3ARN`.
649
+
650
+ The regex isn't used (other than within tests of this repository), so we can safely remove it.
651
+
652
+ ## 61.10.1
653
+
654
+ ### Patch Changes
655
+
656
+ - 0b264a3: Fix resource property of guard duty IAM role for ECS task pattern
657
+
658
+ ## 61.10.0
659
+
660
+ ### Minor Changes
661
+
662
+ - 9db50ef: Add required permissions to GuEcsTask pattern for guard duty sidecar container
663
+
664
+ ### Patch Changes
665
+
666
+ - 6c611c8: Broaden CDK peer dependency ranges to allow any aws-cdk/construct version provided more recent than the specified version
667
+
668
+ ## 61.9.0
669
+
670
+ ### Minor Changes
671
+
672
+ - 339c2e9: Improves the safety of the new deployment mechanism for services which scale horizontally.
673
+
674
+ As part of this the `default` and `maxValue` properties of the `MinInstancesInServiceFor<app>` parameter (which is used by Riff-Raff) have been removed.
675
+
676
+ ### Patch Changes
677
+
678
+ - 888d5e2: Update aws-cdk to 2.1018.0, aws-cdk-lib to 2.200.1, constructs to 10.4.2
679
+
680
+ ## 61.8.2
681
+
682
+ ### Patch Changes
683
+
684
+ - 1336b63: Update import path of `ContainerInsights`.
685
+
686
+ ## 61.8.1
687
+
688
+ ### Patch Changes
689
+
690
+ - 2ec1d32: chore(deps): bump `codemaker` from 1.111.0 to 1.112.0
691
+
692
+ ## 61.8.0
693
+
694
+ ### Minor Changes
695
+
696
+ - 0cc9129: Addition of [slow start mode](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/edit-target-group-attributes.html#slow-start-mode) support for `GuEc2AppExperimental`.
697
+
698
+ We recommend enabling this setting if you run a high-traffic service, particularly if it is JVM-based.
699
+
700
+ ## 61.7.0
701
+
702
+ ### Minor Changes
703
+
704
+ - d1ee03a: feat(GuEc2App): Replace `enabledDetailedInstanceMonitoring` optional property with mandatory `instanceMetricGranularity` property
705
+
706
+ Specifying how an ASG service should be monitored is now explicitly required.
707
+ When detailed monitoring is enabled, EC2 metrics are produced at a higher granularity of one minute (default is five minutes).
708
+ This should allow for earlier horizontal scaling and provide more detail during incident triage.
709
+
710
+ This change will cost roughly $3 per instance per month.
711
+ We'd recommend using detailed monitoring for production environments.
712
+
713
+ See also:
714
+ - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/manage-detailed-monitoring.html
715
+ - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/viewing_metrics_with_cloudwatch.html
716
+
717
+ ## 61.6.0
718
+
719
+ ### Minor Changes
720
+
721
+ - 50d5978: Addition of new experimental deployment mechanism support for MAPI.
722
+
723
+ ## 61.5.2
724
+
725
+ ### Patch Changes
726
+
727
+ - 515e00e: Update aws-cdk to 2.1014.0, aws-cdk-lib to 2.195.0, constructs to 10.4.2
728
+
729
+ ## 61.5.1
730
+
731
+ ### Patch Changes
732
+
733
+ - 34c96ee: fix(GuEcsTaskProps): Change type of `containerInsights` property from `boolean` to `ContainerInsights`.
734
+
735
+ This enables support of enhanced ECS monitoring and addresses an AWS CDK deprecation warning.
736
+
737
+ ## 61.5.0
738
+
739
+ ### Minor Changes
740
+
741
+ Removes `GuWazuhAccess` security group as Wazuh has been deprecated (#2561).
742
+
743
+ This change will remove a resource of logical ID `WazuhSecurityGroup` from stacks that use a `GuAutoScalingGroup`.
744
+ The snapshot diff will include the removal of the following resource:
745
+
746
+ ```json
747
+ {
748
+ "Resources": {
749
+ "WazuhSecurityGroup": {
750
+ "Properties": {
751
+ "GroupDescription": "Allow outbound traffic from wazuh agent to manager",
752
+ "SecurityGroupEgress": [
753
+ {
754
+ "CidrIp": "0.0.0.0/0",
755
+ "Description": "Wazuh event logging",
756
+ "FromPort": 1514,
757
+ "IpProtocol": "tcp",
758
+ "ToPort": 1514
759
+ },
760
+ {
761
+ "CidrIp": "0.0.0.0/0",
762
+ "Description": "Wazuh agent registration",
763
+ "FromPort": 1515,
764
+ "IpProtocol": "tcp",
765
+ "ToPort": 1515
766
+ }
767
+ ],
768
+ "Type": "AWS::EC2::SecurityGroup"
769
+ }
770
+ }
771
+ }
772
+ }
773
+ ```
774
+
775
+ #### How to update to this version
776
+
777
+ This version of `@guardian/cdk` detaches the `WazuhSecurityGroup` security group from any autoscaling group and deletes it in one step.
778
+ When using [Riff-Raff's autoscaling deployment type](https://riffraff.gutools.co.uk/docs/magenta-lib/types#autoscaling), upgrading needs to be performed in two steps, across two independent pull requests.
779
+ If we do not, Riff-Raff will fail with an error similar to:
780
+
781
+ > WazuhSecurityGroup(AWS::EC2::SecurityGroup}: DELETE_FAILED resource sg-1234 has a dependent object (Service: Ec2, Status Code: 400) (SDK Attempt Count: 1)
782
+
783
+ 1. For the first pull request, we'll detach the `WazuhSecurityGroup` security group from the autoscaling group.
784
+
785
+ In this step, we detach the `WazuhSecurityGroup` security group from the autoscaling group by upgrading to v61.5.0
786
+ and temporarily recreate `WazuhSecurityGroup` as a resource in the CloudFormation stack:
787
+
788
+ ```ts
789
+ declare const myApp: GuEc2App;
790
+
791
+ const { vpc } = myApp;
792
+
793
+ // A temporary security group with a fixed logical ID, replicating the one removed from GuCDK v61.5.0.
794
+ const tempSecurityGroup = new SecurityGroup(this, "WazuhSecurityGroup", {
795
+ vpc,
796
+ // Must keep the same description, else CloudFormation will try to replace the security group
797
+ // See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-securitygroup.html#cfn-ec2-securitygroup-groupdescription.
798
+ description: "Allow outbound traffic from wazuh agent to manager",
799
+ });
800
+ this.overrideLogicalId(tempSecurityGroup, {
801
+ logicalId: "WazuhSecurityGroup",
802
+ reason: "Part one of updating to GuCDK 61.5.0+ whilst using Riff-Raff's ASG deployment type",
803
+ });
804
+ ```
805
+
806
+ 2. For the second pull request, we'll remove the `WazuhSecurityGroup` security group.
807
+
808
+ Now that the security group is unused, we can remove it from the stack by deleting the `tempSecurityGroup` variable created above.
809
+
810
+ > [!NOTE]
811
+ >
812
+ > - We've opted against issuing a release for each of these steps as most projects upgrade to the latest version.
813
+ > - The new deployment mechanism offered by `GuEc2AppExperimental` does not need this workaround as CloudFormation works out the dependency tree itself.
814
+
815
+ ## 61.4.0
816
+
817
+ ### Minor Changes
818
+
819
+ - 0426904: Removal of the `withoutImdsv2` property from `GuEc2App` and `GuAutoScalingGroup`.
820
+ When this property was set to `true`, launched instances would not meet the [FSBP EC2.8 control](https://docs.aws.amazon.com/securityhub/latest/userguide/ec2-controls.html#ec2-8).
821
+
822
+ Removing this property as a signal that GuCDK will follow FSBP controls by default.
823
+
824
+ If for whatever reason you need to disable IMDSv2, you can do so via an [escape hatch](https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html):
825
+
826
+ ```typescript
827
+ import { CfnLaunchTemplate } from "aws-cdk-lib/aws-ec2";
828
+
829
+ declare const asg: GuAutoScalingGroup;
830
+
831
+ const launchTemplate = asg.instanceLaunchTemplate.node.defaultChild as CfnLaunchTemplate;
832
+
833
+ // Set the value to "optional", allowing IMDSv1 and IMDSv2.
834
+ // See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-metadataoptions.html#cfn-ec2-launchtemplate-metadataoptions-httptokens.
835
+ launchTemplate.addPropertyOverride("LaunchTemplateData.MetadataOptions.HttpTokens", "optional");
836
+
837
+ // Or remove the property entirely.
838
+ launchTemplate.addPropertyDeletionOverride("LaunchTemplateData.MetadataOptions.HttpTokens");
839
+ ```
840
+
841
+ ## 61.3.4
842
+
843
+ ### Patch Changes
844
+
845
+ - 3851bd2: Upgrade to ESLint 9.x and @guardian/eslint-config
846
+
847
+ ## Upgrade Guide
848
+ 1. Update required dependencies
849
+
850
+ ```bash
851
+ # NPM
852
+ npm uninstall @guardian/eslint-config-typescript --save-dev
853
+ npm install eslint@^9.24.0 --save-dev
854
+ npm install @guardian/eslint-config@^11.0.0 --save-dev
855
+
856
+ # Or YARN
857
+ yarn remove @guardian/eslint-config-typescript --dev
858
+ yarn add eslint@^9.24.0 --dev
859
+ yarn add @guardian/eslint-config@^11.0.0 --dev
860
+ ```
861
+
862
+ 2. Switch to using a flat [eslint config](https://eslint.org/docs/latest/use/configure/migration-guide)
863
+
864
+ A lot of the config that we used to define is now available by default in the shared` @guardian/eslint-config` library.
865
+
866
+ ```bash
867
+ # Remove deprecated .eslintrc config
868
+ rm .eslintrc
869
+
870
+ # Replace with newer eslint.config.mjs
871
+ # Most config options we want are enabled by default now in `@guardian/eslint-config` so we can
872
+ # have a fairly minimal eslint config file.
873
+ cat >> eslint.config.mjs << 'END'
874
+ import guardian from '@guardian/eslint-config';
875
+
876
+ export default [
877
+ ...guardian.configs.recommended,
878
+ ...guardian.configs.jest
879
+ ];
880
+ END
881
+ ```
882
+
883
+ 3. Remove [unsupported](https://eslint.org/docs/latest/use/configure/migration-guide#cli-flag-changes) `--ext` flag from `lint` script in `package.json`
884
+
885
+ ```bash
886
+ # Remove --ext .ts from `npm run lint` script
887
+ sed -i '' '/--ext .ts/d' ./package.json
888
+ ```
889
+
890
+ ## 61.3.3
891
+
892
+ ### Patch Changes
893
+
894
+ - e62ed3d: Update aws-cdk to 2.1007.0, aws-cdk-lib to 2.189.0, constructs to 10.4.2
895
+
896
+ ## 61.3.2
897
+
898
+ ### Patch Changes
899
+
900
+ - 63210c1: Update aws-cdk to 2.1005.0, aws-cdk-lib to 2.185.0, constructs to 10.4.2
901
+
902
+ > [!NOTE]
903
+ > The versions of `aws-cdk` and `aws-cdk-lib` are no longer in sync.
904
+ > See https://github.com/aws/aws-cdk/issues/32775.
905
+
906
+ The following command can be used to check what peer dependencies are required:
907
+
908
+ ```bash
909
+ npm info @guardian/cdk@latest version peerDependencies
910
+ ```
911
+
912
+ ## 61.3.1
913
+
914
+ ### Patch Changes
915
+
916
+ - 57ed86d: GuKCLPolicy: Fix DynamoDB permissions on new KCL v3 tables
917
+
918
+ ## 61.3.0
919
+
920
+ ### Minor Changes
921
+
922
+ - fabe6d1: Fix construct id for GuKCLPolicy
923
+
924
+ ## 61.2.0
925
+
926
+ ### Minor Changes
927
+
928
+ - 5cae0ff: Add GuKCLPolicy, a IAM-policy construct for the Kinesis Client Library
929
+
930
+ ## 61.1.4
931
+
932
+ ### Patch Changes
933
+
934
+ - c19ee84: Update aws-cdk to 2.178.1, aws-cdk-lib to 2.178.1, constructs to 10.4.2
935
+
936
+ ## 61.1.3
937
+
938
+ ### Patch Changes
939
+
940
+ - f3e3fe8: Update aws-cdk to 2.177.0, aws-cdk-lib to 2.177.0, constructs to 10.4.2
941
+
942
+ ## 61.1.2
943
+
944
+ ### Patch Changes
945
+
946
+ - fc1b881: Update aws-cdk to 2.175.1, aws-cdk-lib to 2.175.1, constructs to 10.4.2
947
+
948
+ ## 61.1.1
949
+
950
+ ### Patch Changes
951
+
952
+ - d1b7fa6: Update aws-cdk to 2.175.0, aws-cdk-lib to 2.175.0, constructs to 10.4.2
953
+
954
+ ## 61.1.0
955
+
956
+ ### Minor Changes
957
+
958
+ - a11349f: Expose taskDefinition, containerDefinition and task in `GuEcsTask`
959
+
960
+ ## 61.0.2
961
+
962
+ ### Patch Changes
963
+
964
+ - 3098169: Update aws-cdk to 2.172.0, aws-cdk-lib to 2.172.0, constructs to 10.4.2
965
+
966
+ ## 61.0.1
967
+
968
+ ### Patch Changes
969
+
970
+ - 60639fd: Apply the standard `Stack`, `Stage`, `App` and `gu:repo` tags to the `AWS::IAM::OIDCProvider` resource
971
+ created via the `GitHubOidcProvider` construct.
972
+
973
+ ## 61.0.0
974
+
975
+ ### Major Changes
976
+
977
+ - d3259e7: Support multiple usages of `GuGithubActionsRole` in a single AWS account
978
+
979
+ This significantly changes the resources constructed by `GuGithubActionsRole`,
980
+ specifically, **the construct will no longer instantiate a `GitHubOidcProvider`**.
981
+ This is because you can only ever have one `GitHubOidcProvider` per provider
982
+ domain (ie `token.actions.githubusercontent.com`) - while we may want multiple
983
+ instances of `GuGithubActionsRole` in an AWS account, we can't have the
984
+ `GuGithubActionsRole` construct trying to make a new `GitHubOidcProvider` with
985
+ each instance.
986
+
987
+ Consequently, you will need to instantiate the `GitHubOidcProvider` elsewhere
988
+ as a singleton. At the Guardian, we do this with https://github.com/guardian/aws-account-setup.
989
+
990
+ ### Minor Changes
991
+
992
+ - bf08a5e: Default to GP3 storage type for RDS
993
+
994
+ ## 60.1.3
995
+
996
+ ### Patch Changes
997
+
998
+ - b488c2e: Update aws-cdk to 2.170.0, aws-cdk-lib to 2.170.0, constructs to 10.4.2
999
+
1000
+ ## 60.1.2
1001
+
1002
+ ### Patch Changes
1003
+
1004
+ - b8f4bbe: Update `codemaker` from 1.104.0 to 1.105.0
1005
+ - 0d7dd47: Update `git-url-parse` from 15.0.0 to 16.0.0
1006
+
1007
+ ## 60.1.1
1008
+
1009
+ ### Patch Changes
1010
+
1011
+ - d00fa34: Update `aws-sdk` from 2.1691.0 to 2.1692.0
1012
+
1013
+ ## 60.1.0
1014
+
1015
+ ### Minor Changes
1016
+
1017
+ - 6e67597: feat(riff-raff.yaml): Add `minInstancesInServiceParameters` when applicable
1018
+
1019
+ To complement the changes in https://github.com/guardian/riff-raff/pull/1383,
1020
+ add the `minInstancesInServiceParameters` property to the `riff-raff.yaml` file when applicable.
1021
+
1022
+ ## 60.0.0
1023
+
1024
+ ### Major Changes
1025
+
1026
+ - 1105831: Set CPU architecture of ECS tasks to ARM64
1027
+ - 8e1c15f: ECS task now uses GuVpc.subnetsFromParameter rather than defaulting to CDK context
1028
+
1029
+ Note that this is a breaking change, because the previous behaviour was [this](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.EcsRunTask.html#subnets)
1030
+ - which relied on a CDK context file with details of the different subnets.
1031
+
1032
+ ### Patch Changes
1033
+
1034
+ - 3d26489: Update aws-cdk to 2.166.0, aws-cdk-lib to 2.166.0, constructs to 10.4.2
1035
+
1036
+ ## 59.5.6
1037
+
1038
+ ### Patch Changes
1039
+
1040
+ - 55c7c09: Update aws-cdk to 2.162.1, aws-cdk-lib to 2.162.1, constructs to 10.4.2
1041
+
1042
+ ## 59.5.5
1043
+
1044
+ ### Patch Changes
1045
+
1046
+ - c6fed4d: Update aws-cdk to 2.161.1, aws-cdk-lib to 2.161.1, constructs to 10.3.0
1047
+ - 81e6c5a: chore(deps): bump `codemaker` from 1.103.1 to 1.104.0
1048
+
1049
+ ## 59.5.4
1050
+
1051
+ ### Patch Changes
1052
+
1053
+ - 08e6833: Revert mistakenly published version v59.5.3
1054
+
1055
+ ## 59.5.3
1056
+
1057
+ **DO NOT USE**: Published by mistake.
1058
+
1059
+ ## 59.5.2
1060
+
1061
+ ### Patch Changes
1062
+
1063
+ - 1110a11: fix(experimental-ec2-pattern): Create Policy first
1064
+
1065
+ When deploying Prism with the `GuEc2AppExperimental` for the first time, the deployment failed with the cloud-init-output logs stating:
1066
+
1067
+ ```log
1068
+ An error occurred (AccessDenied) when calling the DescribeTargetHealth operation: User: arn:aws:sts::000000000000:assumed-role/prism-CODE-InstanceRolePrism/i-0cee86d64de253ca4 is not authorized to perform: elasticloadbalancing:DescribeTargetHealth because no identity-based policy allows the elasticloadbalancing:DescribeTargetHealth action
1069
+ ```
1070
+
1071
+ This suggests the instance update was started before the policy was created.
1072
+
1073
+ Make the ASG depend on the policy that grants these permissions to resolve, as CloudFormation creates dependencies first.
1074
+
1075
+ - 5add16c: feat(experimental-ec2-pattern): Tag launch template to improve observability
1076
+
1077
+ ## 59.5.1
1078
+
1079
+ ### Patch Changes
1080
+
1081
+ - fed2598: fix(experimental-ec2-pattern): Add buffer to rolling update timeout
1082
+
1083
+ If we consider the health check grace period to be the time it takes the "normal" user data to run,
1084
+ the rolling update should be configured to be a little longer to cover the additional time spent polling the target group.
1085
+
1086
+ A buffer of 1 minute is somewhat arbitrarily chosen.
1087
+ Too high a value, then we increase the time it takes to automatically rollback from a failing healthcheck.
1088
+ Too low a value, then we risk flaky deploys.
1089
+
1090
+ ## 59.5.0
1091
+
1092
+ ### Minor Changes
1093
+
1094
+ - f4e2a7c: feat(experimental-ec2-pattern): Pattern to deploy ASG updates w/CFN
1095
+
1096
+ Included in this update is a new experimental pattern `GuEc2AppExperimental`, which can be used in place of a `GuEc2App`:
1097
+
1098
+ ```ts
1099
+ import { GuEc2AppExperimental } from "@guardian/cdk/lib/experimental/patterns/ec2-app";
1100
+ ```
1101
+
1102
+ This pattern will add an [`AutoScalingRollingUpdate` policy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html#cfn-attributes-updatepolicy-rollingupdate)
1103
+ to the autoscaling group.
1104
+ This allows application updates to be performed like a standard CloudFormation update,
1105
+ and using the custom logic provided by Riff-Raff's `autoscaling` deployment type is unnecessary.
1106
+
1107
+ This experimental pattern has few requirements.
1108
+
1109
+ ## Add the build number to the application artifact
1110
+
1111
+ This change requires versioned artifacts.
1112
+
1113
+ The easiest way to achieve this is by adding the build number to the filename of the artifact:
1114
+
1115
+ ```ts
1116
+ import { UserData } from "aws-cdk-lib/aws-ec2";
1117
+ // Use a GitHub Actions provided environment variable
1118
+ const buildNumber = process.env.GITHUB_RUN_NUMBER ?? "DEV";
1119
+
1120
+ const userData = UserData.forLinux();
1121
+ userData.addCommands(`aws s3 cp s3://dist-bucket/path/to/artifact-${buildNumber}.deb /tmp/artifact.deb`);
1122
+ userData.addCommands(`dpkg -i /tmp/artifact.dep`);
1123
+ ```
1124
+
1125
+ ## `riff-raff.yaml`
1126
+
1127
+ The `riff-raff.yaml` file should remove the `deploy` action of the `autoscaling` deployment type.
1128
+ Though including it shouldn't break anything, it would result in a longer deployment time as instance will be rotated by both CloudFormation and Riff-Raff's custom logic.
1129
+
1130
+ The `uploadArtifacts` step of the `autoscaling` deployment type should still be included, with the `cloud-formation` deployment type depending on it.
1131
+ This step uploads the versioned artifact to S3.
1132
+
1133
+ > [!TIP]
1134
+ > An [auto-generated `riff-raff.yaml` file](https://github.com/guardian/cdk/blob/main/src/riff-raff-yaml-file/README.md) meets this requirement.
1135
+
1136
+ ## 59.4.0
1137
+
1138
+ ### Minor Changes
1139
+
1140
+ - 43dc653: feat(asg) Collect all ASG level metrics
1141
+
1142
+ This change should have no cost impact:
1143
+
1144
+ > Group metrics are available at one-minute granularity at no additional charge, but you must enable them.
1145
+ > – https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-metrics.html.
1146
+
1147
+ If it does, or if you only want a subset, the escape hatch mechanism can be used:
1148
+
1149
+ ```ts
1150
+ declare const asg: AutoScalingGroup;
1151
+
1152
+ const cfnAsg = asg.node.defaultChild as CfnAutoScalingGroup;
1153
+
1154
+ cfnAsg.metricsCollection = [
1155
+ {
1156
+ granularity: "1Minute",
1157
+ metrics: [
1158
+ // A subset of metrics
1159
+ ],
1160
+ },
1161
+ ];
1162
+ ```
1163
+
1164
+ ## 59.3.5
1165
+
1166
+ ### Patch Changes
1167
+
1168
+ - 9ff96cd: Update aws-cdk to 2.157.0, aws-cdk-lib to 2.157.0, constructs to 10.3.0
1169
+
1170
+ ## 59.3.4
1171
+
1172
+ ### Patch Changes
1173
+
1174
+ - 7d214d6: Update `git-url-parse` from 14.1.0 to 15.0.0
1175
+ - 19d41d3: Update `aws-sdk` from 2.1687.0 to 2.1691.0
1176
+
1177
+ ## 59.3.3
1178
+
1179
+ ### Patch Changes
1180
+
1181
+ - c57b024: Allow inputs in GuScheduledLambda
1182
+
1183
+ ## 59.3.2
1184
+
1185
+ ### Patch Changes
1186
+
1187
+ - 8e8a20f: Fix bug preventing creation of multiple VPCs in single stack
1188
+
1189
+ ## 59.3.1
1190
+
1191
+ ### Patch Changes
1192
+
1193
+ - 89dee99: Update aws-cdk to 2.155.0, aws-cdk-lib to 2.155.0, constructs to 10.3.0
1194
+ - 9412236: Update `aws-sdk` from 2.1674.0 to 2.1687.0
1195
+ - 481e40d: Update `codemaker` from 1.102.0 to 1.103.1
1196
+
1197
+ ## 59.3.0
1198
+
1199
+ ### Minor Changes
1200
+
1201
+ - 18daa5d: enable InstanceMetadataTags on EC2 patterns
1202
+
1203
+ ## 59.2.4
1204
+
1205
+ ### Patch Changes
1206
+
1207
+ - 72c6eec: Update aws-cdk to 2.153.0, aws-cdk-lib to 2.153.0, constructs to 10.3.0
1208
+ - bef9b1d: Update `aws-sdk` from 2.1670.0 to 2.1674.0
1209
+
1210
+ ## 59.2.3
1211
+
1212
+ ### Patch Changes
1213
+
1214
+ - 3b90072: Update `codemaker` from 1.101.0 to 1.102.0
1215
+ - 82016de: Update `aws-sdk` from 2.1665.0 to 2.1670.0
1216
+
1217
+ ## 59.2.2
1218
+
1219
+ ### Patch Changes
1220
+
1221
+ - c7426d3: Only set an SSL policy on HTTPS application listeners
1222
+ - 754c919: Update `aws-sdk` from 2.1664.0 to 2.1665.0
1223
+
1224
+ ## 59.2.1
1225
+
1226
+ ### Patch Changes
1227
+
1228
+ - 7ed3595: Update `aws-sdk` from 2.1649.0 to 2.1664.0.
1229
+ - 006e3a4: Update `git-url-parse` from 14.0.0 to 14.1.0.
1230
+
1231
+ ## 59.2.0
1232
+
1233
+ ### Minor Changes
1234
+
1235
+ - 8700b29: feat(asg): Allow setting the defaultInstanceWarmup option on auto scaling groups provisioned by our EC2 pattern
1236
+
1237
+ ## 59.1.0
1238
+
1239
+ ### Minor Changes
1240
+
1241
+ - 0a0bce1: : feat(asg): Allow setting the detailedMonitoring option on launch templates provisioned by our EC2 patterns
1242
+
1243
+ ## 59.0.0
1244
+
1245
+ ### Major Changes
1246
+
1247
+ - e15d900: GuCDK EC2 patterns now require an explicit `UserData` or `GuUserDataProps` input, instead of a string.
1248
+
1249
+ The UserData class comes with helpers that allow us to mutate the user data in our patterns which will be helpful with some of our upcoming work.
1250
+ Unfortunately whenever a `string` is passed to our patterns we have to wrap it in a special `CustomUserData` class which disables most of these helpers.
1251
+
1252
+ For applications that were already using `GuUserDataProps` no change is required, however applications that used strings will have to make a small change.
1253
+
1254
+ ```js
1255
+ new GuEc2App({
1256
+ userData: `#!/usr/bin/bash echo "hello world"`,
1257
+ ...
1258
+ })
1259
+ ```
1260
+
1261
+ becomes
1262
+
1263
+ ```js
1264
+ const userData = UserData.forLinux();
1265
+ userData.addCommands(`echo "hello world"`);
1266
+
1267
+ new GuEc2App({
1268
+ userData,
1269
+ ...
1270
+ })
1271
+ ```
1272
+
1273
+ Note that you no longer need to specify a shebang, by default `UserData` adds one for you. If you need to customize this behaviour you can look at the props accepted by `forLinux`.
1274
+ You may also want to look at some of the other methods that UserData has to understand if it may be able to help you in other ways, for example `addS3DownloadCommand` the method helps you write commands to download from S3.
1275
+
1276
+ ## 58.2.0
1277
+
1278
+ ### Minor Changes
1279
+
1280
+ - 59ffa9d: feat(asg): Allow setting the UpdatePolicy on ASGs provisioned by our EC2 patterns
1281
+ - 689b59a: Bump @guardian/tsconfig to 1.0.0 and specifically set moduleResolution to "node"
1282
+
1283
+ ## 58.1.4
1284
+
1285
+ ### Patch Changes
1286
+
1287
+ - c015419: Update aws-cdk to 2.148.0, aws-cdk-lib to 2.148.0, constructs to 10.3.0
1288
+ - 7051a7c: fix(ec2-app): Use `clientSecretValue` prop over deprecated `clientSecret`
1289
+ - 9cfabc6: fix(lambda): Use `loggingFormat` prop over deprecated `logFormat`
1290
+
1291
+ ## 58.1.3
1292
+
1293
+ ### Patch Changes
1294
+
1295
+ - 16c7086: Limit the length of the cognito user pool domainPrefix generated by the Ec2App googleAuth functionality to 63 characters
1296
+ - 816f3a2: bump codemaker from 1.100.0 to 1.101.0
1297
+ - 94640e9: bump typedoc from 0.26.2 to 0.26.3
1298
+ - 4eee825: bump @changesets/cli from 2.27.5 to 2.27.7
1299
+
1300
+ ## 58.1.2
1301
+
1302
+ ### Patch Changes
1303
+
1304
+ - 87242ca: Update aws-cdk to 2.145.0, aws-cdk-lib to 2.145.0, constructs to 10.3.0
1305
+
1306
+ ## 58.1.1
1307
+
1308
+ ### Patch Changes
1309
+
1310
+ - 1da0da9: Update aws-cdk to 2.141.0, aws-cdk-lib to 2.141.0, constructs to 10.3.0
1311
+ - c8400c9: Add useful ASG group metrics (TOTAL_INSTANCES, etc) by default
1312
+
1313
+ ## 58.1.0
1314
+
1315
+ ### Minor Changes
1316
+
1317
+ - 96cb7dc: Use the recommended ELB security policy `ELBSecurityPolicy-TLS13-1-2-2021-06` which includes TLS 1.3, and is backwards compatible with TLS 1.2.
1318
+
1319
+ ## 58.0.0
1320
+
1321
+ ### Major Changes
1322
+
1323
+ - fa0719b: BREAKING CHANGE: DevX Backups can no longer be enabled via the `withBackup` prop, which has been removed.
1324
+
1325
+ Users should now opt-in/out of DevX Backups at the construct level (i.e. when defining an RDS instance, cluster or
1326
+ DynamoDB table).
1327
+
1328
+ We recommend using the `GuDatabaseInstance` or `GuDynamoTable` to help with this. If these constructs cannot be used,
1329
+ resources can also be tagged like this: `Tags.of(myDatabase).add("devx-backup-enabled", "true")`.
1330
+
1331
+ ## 57.1.0
1332
+
1333
+ ### Minor Changes
1334
+
1335
+ - 8bde0ca: Add Dynamodb construct with default deletion protection and mandatory opt-in/opt-out setting for DevX-backup.
1336
+
1337
+ ## 57.0.0
1338
+
1339
+ ### Major Changes
1340
+
1341
+ - 7cc8591: BREAKING CHANGE:
1342
+
1343
+ Users of the GuDatabaseInstance class now need to explicitly opt-in/out of
1344
+ DevX Backups via the devXBackups prop.
1345
+
1346
+ ### Minor Changes
1347
+
1348
+ - 197228b: GuLambdaFunction uses JSON logging by default, for compatibility with ApplicationLogLevel
1349
+
1350
+ ## 56.0.3
1351
+
1352
+ ### Patch Changes
1353
+
1354
+ - 89a22f1: Update aws-cdk to 2.136.1, aws-cdk-lib to 2.136.1, constructs to 10.3.0
1355
+
1356
+ ## 56.0.2
1357
+
1358
+ ### Patch Changes
1359
+
1360
+ - a98acf3: Update aws-cdk to 2.134.0, aws-cdk-lib to 2.134.0, constructs to 10.3.0
1361
+
1362
+ ## 56.0.1
1363
+
1364
+ ### Patch Changes
1365
+
1366
+ - 44788e5: Update aws-cdk to 2.132.0, aws-cdk-lib to 2.132.0, constructs to 10.3.0
1367
+
1368
+ ## 56.0.0
1369
+
1370
+ ### Major Changes
1371
+
1372
+ - 5fead41: - Load balancers now add headers with information about the TLS version and cipher suite used during negotiation
1373
+ - Load balancers now drop invalid headers before forwarding requests to the target. Invalid headers are described as HTTP header names that do not conform to the regular expression [-A-Za-z0-9]+
1374
+
1375
+ ### Patch Changes
1376
+
1377
+ - a551119: Apply the `App` tag to the launch template created in the EC2 App pattern.
1378
+ - de7c472: Update dependencies
1379
+ - e1f3751: Fixes a bug where `this.app` on a `GuStack` is always `undefined`, as it is never set.
1380
+
1381
+ See https://github.com/guardian/cdk/pull/1497#issuecomment-1480997050.
1382
+
1383
+ ## 55.0.0
1384
+
1385
+ ### Major Changes
1386
+
1387
+ - 6c5e701: Use PROD version of cognito-auth-lambdas instead of INFRA.
1388
+
1389
+ We no longer update/use the INFRA version of cognito-auth-lambdas, although we won't be making any breaking changes to these lambdas there may be a situation if a user of CDK does not update for a long while, when they switch from INFRA to PROD they will suddenly receive a lot of updates to their lambdas.
1390
+
1391
+ Users should take care to verify that any applications use Google Auth are still functional.
1392
+
1393
+ ## 54.1.0
1394
+
1395
+ ### Minor Changes
1396
+
1397
+ - edf5c7a: - Add `readonlyRootFilesystem` prop to specify whether the container is given read-only access to its root file system
1398
+ - Add `containerInsights` prop to enable CloudWatch insights
1399
+ - Replace deprecated state machine definition
1400
+
1401
+ ## 54.0.0
1402
+
1403
+ ### Major Changes
1404
+
1405
+ - 4548884: This change includes some potentially breaking changes for consumers of:
1406
+ - [`GuEc2App`](https://guardian.github.io/cdk/classes/patterns.GuEc2App.html)
1407
+ - [`GuPlayApp`](https://guardian.github.io/cdk/classes/patterns.GuPlayApp.html) (a subclass of `GuEc2App`)
1408
+ - [`GuPlayWorkerApp`](https://guardian.github.io/cdk/classes/patterns.GuPlayWorkerApp.html) (a subclass of `GuEc2App`)
1409
+ - [`GuNodeApp`](https://guardian.github.io/cdk/classes/patterns.GuNodeApp.html) (a subclass of `GuEc2App`)
1410
+
1411
+ Since [v49.0.2](https://github.com/guardian/cdk/releases/tag/v49.0.2),
1412
+ the EC2 instance profile created in `GuEc2App`, and it's subclasses,
1413
+ used the [`AmazonSSMManagedInstanceCore`](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonSSMManagedInstanceCore.html) AWS Managed Policy
1414
+ to enable the [SSM+SSH capability](https://github.com/guardian/ssm-scala?tab=readme-ov-file#in-aws).
1415
+
1416
+ In addition to enabling SSM+SSH, this Managed Policy also provided read access to all SSM Parameters.
1417
+ This is not least privilege.
1418
+
1419
+ In this version, usage of the `AmazonSSMManagedInstanceCore` Managed Policy is swapped for a custom,
1420
+ more minimal, policy.
1421
+
1422
+ > [!IMPORTANT]
1423
+ > Before upgrading to this version,
1424
+ > ensure your application is not relying on the IAM Policy behaviour provided by `AmazonSSMManagedInstanceCore`.
1425
+
1426
+ If your application is reading SSM Parameters outside the `/STAGE/STACK/APP/*` namespace,
1427
+ you will need to add an explicit policy.
1428
+
1429
+ An IAM Policy to read SSM Parameters in the `/STAGE/STACK/APP/*` namespace is already provided by the `GuEc2App` construct,
1430
+ via [`GuParameterStoreReadPolicy`](https://guardian.github.io/cdk/classes/constructs_iam.GuParameterStoreReadPolicy.html)
1431
+
1432
+ To understand if your application is impacted,
1433
+ consult [this Service Catalogue query](https://metrics.gutools.co.uk/goto/KZhWJVoIg?orgId=1)
1434
+ showing CloudFormation stacks using the above _and_ using GuCDK v49.0.2 or above.
1435
+
1436
+ <details><summary>Query ran in Service Catalogue</summary>
1437
+ <p>
1438
+
1439
+ ```sql
1440
+ with data as (
1441
+ select cfn.account_id
1442
+ , acc.name as account_name
1443
+ , tml.stack_id
1444
+ , cfn.last_updated_time
1445
+ , cfn.region
1446
+ , cfn.stack_name
1447
+ , tml.metadata ->> 'gu:cdk:version' as gucdk_version
1448
+ , cfn.tags ->> 'gu:repo' as repository
1449
+ , cfn.tags ->> 'Stack' as stack
1450
+ , cfn.tags ->> 'Stage' as stage
1451
+ , cfn.tags ->> 'App' as app
1452
+ from aws_cloudformation_template_summaries tml
1453
+ join aws_accounts acc on tml.account_id = acc.id
1454
+ join aws_cloudformation_stacks cfn on tml.stack_arn = cfn.arn
1455
+ where tml.metadata is not null
1456
+ and (
1457
+ (metadata -> 'gu:cdk:constructs')::jsonb ? 'GuEc2App'
1458
+ OR (metadata -> 'gu:cdk:constructs')::jsonb ? 'GuPlayApp'
1459
+ OR (metadata -> 'gu:cdk:constructs')::jsonb ? 'GuPlayWorkerApp'
1460
+ OR (metadata -> 'gu:cdk:constructs')::jsonb ? 'GuNodeApp'
1461
+ )
1462
+ ),
1463
+ ownership as (
1464
+ select distinct full_name
1465
+ , galaxies_team
1466
+ , team_contact_email
1467
+ from view_repo_ownership
1468
+ where galaxies_team is not null
1469
+ and team_contact_email is not null
1470
+ )
1471
+
1472
+ select data.*
1473
+ , ownership.galaxies_team
1474
+ , ownership.team_contact_email
1475
+ from data
1476
+ left join ownership on data.repository = ownership.full_name
1477
+ where gucdk_version like '49%' -- affected version is 49.0.2 onwards, so this will catch some extra stacks, but hopefully not too many!
1478
+ OR gucdk_version like '5%';
1479
+ ```
1480
+
1481
+ </p>
1482
+ </details>
1483
+
1484
+ ## 53.1.1
1485
+
1486
+ ### Patch Changes
1487
+
1488
+ - ec6bd81: Update aws-cdk to 2.127.0, aws-cdk-lib to 2.127.0, constructs to 10.3.0
1489
+
1490
+ ## 53.1.0
1491
+
1492
+ ### Minor Changes
1493
+
1494
+ - ac7354f: Support multiple EC2 apps with load balancer access logs enabled
1495
+
1496
+ ## 53.0.3
1497
+
1498
+ ### Patch Changes
1499
+
1500
+ - 8ead267: Remove direct dependencies that should be peer ones:
1501
+ - `aws-cdk-lib`
1502
+ - `constructs`
1503
+
1504
+ No change for consumers that provide compatible packages
1505
+
1506
+ ## 53.0.2
1507
+
1508
+ ### Patch Changes
1509
+
1510
+ - d21b90e: Update aws-cdk to 2.121.1, aws-cdk-lib to 2.121.1, constructs to 10.3.0
1511
+
1512
+ ## 53.0.1
1513
+
1514
+ ### Patch Changes
1515
+
1516
+ - 2fd963b: Make dependency `@changeset/cli` development only
1517
+
1518
+ ## 53.0.0
1519
+
1520
+ ### Major Changes
1521
+
1522
+ - af50cf5: Removes supports for Stack Sets (added in #977) as it's no longer used,
1523
+ because of a lack of CD tooling support for deploying Stack Sets.
1524
+
1525
+ Removing unused code means less code to maintain, and reduced complexity.
1526
+
1527
+ Should Stack Sets be needed in future, https://github.com/cdklabs/cdk-stacksets offers an alternative approach to creating them in CDK.
1528
+
1529
+ ## 52.3.1
1530
+
1531
+ ### Patch Changes
1532
+
1533
+ - a473265: fix(deps): Update AWS CDK libraries to 2.114.1, and constructs to 10.3.0
1534
+
1535
+ ## 52.3.0
1536
+
1537
+ ### Minor Changes
1538
+
1539
+ - 8c40db382: Adds the optional `enableDistributablePolicy` prop to `GuEcsTask` so that consumers of this pattern can decide whether the task IAM role has access to the account's distributable bucket in S3.
1540
+
1541
+ ## 52.2.1
1542
+
1543
+ ### Patch Changes
1544
+
1545
+ - fcbabb5de: Update AWS CDK libraries to 2.109.0, and constructs to 10.3.0
1546
+
1547
+ ## 52.2.0
1548
+
1549
+ ### Minor Changes
1550
+
1551
+ - 5ee2c0955: feat(backup): Support backups provided by DevX
1552
+
1553
+ Adds a new property `withBackup` to `GuStack` to enable backups provided by DevX.
1554
+
1555
+ When `true`, all supported resources in the stack will receive a new tag `devx-backup-enabled`.
1556
+
1557
+ To opt in/out an individual resource, you can manually apply this tag.
1558
+
1559
+ See https://github.com/guardian/aws-backup.
1560
+
1561
+ ## 52.1.0
1562
+
1563
+ ### Minor Changes
1564
+
1565
+ - 8541732ec: feat(riff-raff.yaml): Support cross stack dependencies
1566
+
1567
+ Currently the `riff-raff.yaml` generator is not able to create dependencies between `cloud-formation` deployments. This means each `cloud-formation` deployment could happen at the same time.
1568
+
1569
+ This does not work in the scenario where we have:
1570
+ - Stack A containing a bucket
1571
+ - Stack B CODE containing an app that uses A's bucket
1572
+ - Stack B PROD containing an app that uses A's bucket
1573
+
1574
+ That is, we can't guarantee Stack A is deployed first.
1575
+
1576
+ In this change we add support for the scenario where we have a shared resources stack.
1577
+ The generated `riff-raff.yaml` file will describe that Stack B CODE, and Stack B PROD depend on Stack A.
1578
+
1579
+ It uses the AWS CDK mechanism https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html#addwbrdependencytarget-reason.
1580
+
1581
+ ## 52.0.0
1582
+
1583
+ ### Major Changes
1584
+
1585
+ - 2fd7d333c: Remove support for classic load balancers.
1586
+
1587
+ Use of application load balancers (ALBs) is considered best practice,
1588
+ as ALBs are receiving [more capabilities](https://aws.amazon.com/elasticloadbalancing/features/) than elastic (classic) load balancers (ELBs).
1589
+ GuCDK should be encoding best practice, so remove support for ELBs.
1590
+
1591
+ Please adopt application load balancers instead, or if necessary, use ELBs directly from AWS CDK.