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