From c1d778254346aea444ae844a17d0cab296cce4bb Mon Sep 17 00:00:00 2001 From: Ashish Dhingra <67916761+ashishdhingra@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:07:36 -0700 Subject: [PATCH 1/3] feat(synthetics): syn-nodejs-puppeteer-9.0 as supported runtime (#31272) ### Issue # (if applicable) Closes #31271. ### Reason for this change [Runtime versions using Node.js and Puppeteer](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html) confirms that Synthetics runtime `syn-nodejs-puppeteer-9.0` is available. ### Description of changes Added `syn-nodejs-puppeteer-9.0` as supported runtime. ### Description of how you validated changes N/A ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts b/packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts index 836c60de52f2b..a44f914678a52 100644 --- a/packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts +++ b/packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts @@ -221,6 +221,19 @@ export class Runtime { */ public static readonly SYNTHETICS_NODEJS_PUPPETEER_8_0 = new Runtime('syn-nodejs-puppeteer-8.0', RuntimeFamily.NODEJS); + /** + * `syn-nodejs-puppeteer-9.0` includes the following: + * - Lambda runtime Node.js 20.x + * - Puppeteer-core version 22.12.1 + * - Chromium version 126.0.6478.126 + * + * New Features: + * - **Bug fixes** Bug fix to enable visual monitoring capabilities. + * + * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-9.0 + */ + public static readonly SYNTHETICS_NODEJS_PUPPETEER_9_0 = new Runtime('syn-nodejs-puppeteer-9.0', RuntimeFamily.NODEJS); + /** * `syn-python-selenium-1.0` includes the following: * - Lambda runtime Python 3.8 From d0f9688423d1e12c00aebb7a9ff3cecd68d3bb3c Mon Sep 17 00:00:00 2001 From: LaurenceWarne <17688577+LaurenceWarne@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:44:05 +0100 Subject: [PATCH 2/3] feat(scheduler): validate schedule name length (#31200) ### Issue # (if applicable) N/A ### Reason for this change To catch name too long errors before hitting Cloudformation. ### Description of changes I've added a length assertion in the `Schedule` constructor against the schedule name length, the documentation on schedule name already makes it clear that there is a limit though AFAICS this isn't validated. Also see the Cloudformation doc here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-scheduler-schedule.html#cfn-scheduler-schedule-name. ### Description of how you validated changes I've added a unit test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts | 5 ++++- .../aws-scheduler-alpha/test/schedule.test.ts | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts b/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts index b9e543c5ef802..1d3774d432ed0 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts +++ b/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts @@ -1,4 +1,4 @@ -import { Duration, IResource, Resource } from 'aws-cdk-lib'; +import { Duration, IResource, Resource, Token } from 'aws-cdk-lib'; import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; import * as kms from 'aws-cdk-lib/aws-kms'; import { CfnSchedule } from 'aws-cdk-lib/aws-scheduler'; @@ -324,6 +324,9 @@ export class Schedule extends Resource implements ISchedule { const flexibleTimeWindow = props.timeWindow ?? TimeWindow.off(); this.validateTimeFrame(props.start, props.end); + if (props.scheduleName && !Token.isUnresolved(props.scheduleName) && props.scheduleName.length > 64) { + throw new Error(`scheduleName cannot be longer than 64 characters, got: ${props.scheduleName.length}`); + } const resource = new CfnSchedule(this, 'Resource', { name: this.physicalName, diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts b/packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts index 901c053d3839f..bb2563d46f6ad 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts @@ -215,6 +215,17 @@ describe('Schedule', () => { }).toThrow('The provided duration must be between 1 minute and 1440 minutes, got 0'); }); + test('throw error when scheduleName exceeds 64 characters', () => { + const name = 'an-extremely-unnecessarily-long-name-exceeding-64-characters-in-length'; + expect(() => { + new Schedule(stack, 'TestSchedule', { + schedule: expr, + target: new SomeLambdaTarget(func, role), + scheduleName: name, + }); + }).toThrow(`scheduleName cannot be longer than 64 characters, got: ${name.length}`); + }); + test('schedule with description', () => { // WHEN new Schedule(stack, 'TestSchedule', { From ee04fff506af5c26ae8cc62dd441d09984044aa7 Mon Sep 17 00:00:00 2001 From: James Butler <107124766+domestic-fennec@users.noreply.github.com> Date: Wed, 4 Sep 2024 21:15:32 +0100 Subject: [PATCH 3/3] docs(elasticloadbalancingv2): update confusing AddNetworkTargets port description (#30208) ### Reason for this change The existing `port` description can be confusing as `listener` could easily be mistaken as a reference to a Load Balancers `listener` and imply that the value should match. Additionally, "traffic" seems more semtantically correct for an NLB than "requests". ### Description of changes Updated the `port` description on `AddNetworkTargetsProps` to match the one used in the `ApplicationTargetGroup` as that uses less ambigous language. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-elasticloadbalancingv2/lib/nlb/network-listener.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts index d7602da51afca..db2ba7d80b8a2 100644 --- a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts @@ -335,7 +335,7 @@ export interface AddNetworkActionProps { */ export interface AddNetworkTargetsProps { /** - * The port on which the listener listens for requests. + * The port on which the target receives traffic. * * @default Determined from protocol if known */