From 9d23caded8aca42d3b78de1bc7e89c38a4d6805e Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Sun, 12 Feb 2023 03:01:28 +0100 Subject: [PATCH] feat(synthetics): support runtime 3.9 (#24101) Synthetics would really rather have everyone on 3.9 instead of 3.8. Add support for the new version and update the examples in the README and the integ tests (didn't update the unit tests, those don't affect correctness of anything). ---- *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-synthetics/README.md | 16 ++++++++-------- .../@aws-cdk/aws-synthetics/lib/runtime.ts | 19 +++++++++++++++++++ .../canary-one.template.json | 14 +++++++------- .../test/integ.canary.js.snapshot/tree.json | 14 +++++++------- .../aws-synthetics/test/integ.canary.ts | 12 ++++++------ .../canary-vpc.assets.json | 2 +- .../test/integ.vpc.js.snapshot/cdk.out | 2 +- .../test/integ.vpc.js.snapshot/integ.json | 2 +- .../test/integ.vpc.js.snapshot/manifest.json | 2 +- .../test/integ.vpc.js.snapshot/tree.json | 2 +- 10 files changed, 52 insertions(+), 33 deletions(-) diff --git a/packages/@aws-cdk/aws-synthetics/README.md b/packages/@aws-cdk/aws-synthetics/README.md index ed4376f45b40c..a2507be64277f 100644 --- a/packages/@aws-cdk/aws-synthetics/README.md +++ b/packages/@aws-cdk/aws-synthetics/README.md @@ -42,7 +42,7 @@ const canary = new synthetics.Canary(this, 'MyCanary', { code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')), handler: 'index.handler', }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, environmentVariables: { stage: 'prod', }, @@ -126,7 +126,7 @@ const canary = new synthetics.Canary(stack, 'Canary', { code: synthetics.Code.fromInline('/* Synthetics handler code'), }), enableAutoDeleteLambdas: true, - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); ``` @@ -152,7 +152,7 @@ new synthetics.Canary(this, 'Inline Canary', { code: synthetics.Code.fromInline('/* Synthetics handler code */'), handler: 'index.handler', // must be 'index.handler' }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); // To supply the code from your local filesystem: @@ -161,7 +161,7 @@ new synthetics.Canary(this, 'Asset Canary', { code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')), handler: 'index.handler', // must end with '.handler' }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); // To supply the code from a S3 bucket: @@ -172,7 +172,7 @@ new synthetics.Canary(this, 'Bucket Canary', { code: synthetics.Code.fromBucket(bucket, 'canary.zip'), handler: 'index.handler', // must end with '.handler' }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); ``` @@ -198,8 +198,8 @@ new synthetics.Canary(this, 'Bucket Canary', { ### Running a canary on a VPC -You can specify what [VPC a canary executes in](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_VPC.html). -This can allow for monitoring services that may be internal to a specific VPC. To place a canary within a VPC, you can specify the `vpc` property with the desired `VPC` to place then canary in. +You can specify what [VPC a canary executes in](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_VPC.html). +This can allow for monitoring services that may be internal to a specific VPC. To place a canary within a VPC, you can specify the `vpc` property with the desired `VPC` to place then canary in. This will automatically attach the appropriate IAM permissions to attach to the VPC. This will also create a Security Group and attach to the default subnets for the VPC unless specified via `vpcSubnets` and `securityGroups`. ```ts @@ -211,7 +211,7 @@ new synthetics.Canary(this, 'Vpc Canary', { code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')), handler: 'index.handler', }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, vpc, }); ``` diff --git a/packages/@aws-cdk/aws-synthetics/lib/runtime.ts b/packages/@aws-cdk/aws-synthetics/lib/runtime.ts index bab3b26d1e9a5..071d7285b9bfb 100644 --- a/packages/@aws-cdk/aws-synthetics/lib/runtime.ts +++ b/packages/@aws-cdk/aws-synthetics/lib/runtime.ts @@ -83,6 +83,7 @@ export class Runtime { * - Chromium version 88.0.4298.0 * * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.0 + * @deprecated Use the latest version instead */ public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_0 = new Runtime('syn-nodejs-puppeteer-3.0', RuntimeFamily.NODEJS); @@ -95,6 +96,7 @@ export class Runtime { * - Chromium version 88.0.4298.0 * * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.1 + * @deprecated Use the latest version instead */ public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_1 = new Runtime('syn-nodejs-puppeteer-3.1', RuntimeFamily.NODEJS); @@ -107,6 +109,7 @@ export class Runtime { * - Chromium version 88.0.4298.0 * * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.2 + * @deprecated Use the latest version instead */ public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_2 = new Runtime('syn-nodejs-puppeteer-3.2', RuntimeFamily.NODEJS); @@ -119,6 +122,7 @@ export class Runtime { * - Chromium version 88.0.4298.0 * * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.3 + * @deprecated Use the latest version instead */ public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_3 = new Runtime('syn-nodejs-puppeteer-3.3', RuntimeFamily.NODEJS); @@ -131,6 +135,7 @@ export class Runtime { * - Chromium version 88.0.4298.0 * * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.4 + * @deprecated Use the latest version instead */ public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_4 = new Runtime('syn-nodejs-puppeteer-3.4', RuntimeFamily.NODEJS); @@ -181,6 +186,20 @@ export class Runtime { */ public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_8 = new Runtime('syn-nodejs-puppeteer-3.8', RuntimeFamily.NODEJS); + /** + * `syn-nodejs-puppeteer-3.9` includes the following: + * + * - Lambda runtime Node.js 14.x + * - Puppeteer-core version 5.5.0 + * - Chromium version 92.0.4512 + * + * New Features: + * - **Dependency upgrades**: Upgrades some third-party dependency packages. + * + * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.9 + */ + public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_9 = new Runtime('syn-nodejs-puppeteer-3.9', RuntimeFamily.NODEJS); + /** * `syn-python-selenium-1.0` includes the following: * - Lambda runtime Python 3.8 diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.canary.js.snapshot/canary-one.template.json b/packages/@aws-cdk/aws-synthetics/test/integ.canary.js.snapshot/canary-one.template.json index 482192cdc7a4b..c60ef66441eeb 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.canary.js.snapshot/canary-one.template.json +++ b/packages/@aws-cdk/aws-synthetics/test/integ.canary.js.snapshot/canary-one.template.json @@ -129,7 +129,7 @@ ] }, "Name": "canary-integ", - "RuntimeVersion": "syn-nodejs-puppeteer-3.8", + "RuntimeVersion": "syn-nodejs-puppeteer-3.9", "Schedule": { "DurationInSeconds": "0", "Expression": "rate(1 minute)" @@ -326,7 +326,7 @@ ] }, "Name": "assetcanary-one", - "RuntimeVersion": "syn-nodejs-puppeteer-3.8", + "RuntimeVersion": "syn-nodejs-puppeteer-3.9", "Schedule": { "DurationInSeconds": "0", "Expression": "rate(5 minutes)" @@ -524,7 +524,7 @@ ] }, "Name": "assetcanary-two", - "RuntimeVersion": "syn-nodejs-puppeteer-3.8", + "RuntimeVersion": "syn-nodejs-puppeteer-3.9", "Schedule": { "DurationInSeconds": "0", "Expression": "rate(5 minutes)" @@ -721,7 +721,7 @@ ] }, "Name": "assetcanary-three", - "RuntimeVersion": "syn-nodejs-puppeteer-3.8", + "RuntimeVersion": "syn-nodejs-puppeteer-3.9", "Schedule": { "DurationInSeconds": "0", "Expression": "rate(5 minutes)" @@ -918,7 +918,7 @@ ] }, "Name": "assetcanary-four", - "RuntimeVersion": "syn-nodejs-puppeteer-3.8", + "RuntimeVersion": "syn-nodejs-puppeteer-3.9", "Schedule": { "DurationInSeconds": "0", "Expression": "rate(5 minutes)" @@ -1115,7 +1115,7 @@ ] }, "Name": "assetcanary-five", - "RuntimeVersion": "syn-nodejs-puppeteer-3.8", + "RuntimeVersion": "syn-nodejs-puppeteer-3.9", "Schedule": { "DurationInSeconds": "0", "Expression": "rate(5 minutes)" @@ -1355,4 +1355,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.canary.js.snapshot/tree.json b/packages/@aws-cdk/aws-synthetics/test/integ.canary.js.snapshot/tree.json index 7a0cc4a4fb6a2..1125b4f366cc6 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.canary.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-synthetics/test/integ.canary.js.snapshot/tree.json @@ -187,7 +187,7 @@ ] }, "name": "canary-integ", - "runtimeVersion": "syn-nodejs-puppeteer-3.8", + "runtimeVersion": "syn-nodejs-puppeteer-3.9", "schedule": { "durationInSeconds": "0", "expression": "rate(1 minute)" @@ -488,7 +488,7 @@ ] }, "name": "assetcanary-one", - "runtimeVersion": "syn-nodejs-puppeteer-3.8", + "runtimeVersion": "syn-nodejs-puppeteer-3.9", "schedule": { "durationInSeconds": "0", "expression": "rate(5 minutes)" @@ -790,7 +790,7 @@ ] }, "name": "assetcanary-two", - "runtimeVersion": "syn-nodejs-puppeteer-3.8", + "runtimeVersion": "syn-nodejs-puppeteer-3.9", "schedule": { "durationInSeconds": "0", "expression": "rate(5 minutes)" @@ -1091,7 +1091,7 @@ ] }, "name": "assetcanary-three", - "runtimeVersion": "syn-nodejs-puppeteer-3.8", + "runtimeVersion": "syn-nodejs-puppeteer-3.9", "schedule": { "durationInSeconds": "0", "expression": "rate(5 minutes)" @@ -1392,7 +1392,7 @@ ] }, "name": "assetcanary-four", - "runtimeVersion": "syn-nodejs-puppeteer-3.8", + "runtimeVersion": "syn-nodejs-puppeteer-3.9", "schedule": { "durationInSeconds": "0", "expression": "rate(5 minutes)" @@ -1693,7 +1693,7 @@ ] }, "name": "assetcanary-five", - "runtimeVersion": "syn-nodejs-puppeteer-3.8", + "runtimeVersion": "syn-nodejs-puppeteer-3.9", "schedule": { "durationInSeconds": "0", "expression": "rate(5 minutes)" @@ -2049,4 +2049,4 @@ "version": "0.0.0" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.canary.ts b/packages/@aws-cdk/aws-synthetics/test/integ.canary.ts index 515aafabad993..b1a26949d054a 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.canary.ts +++ b/packages/@aws-cdk/aws-synthetics/test/integ.canary.ts @@ -31,7 +31,7 @@ new synthetics.Canary(stack, 'MyCanary', { }), schedule: synthetics.Schedule.rate(cdk.Duration.minutes(1)), artifactsBucketLocation: { bucket, prefix }, - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); new synthetics.Canary(stack, 'MyCanaryOne', { @@ -40,7 +40,7 @@ new synthetics.Canary(stack, 'MyCanaryOne', { handler: 'canary.handler', code: synthetics.Code.fromAsset(path.join(__dirname, 'canaries')), }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, enableAutoDeleteLambdas: true, }); @@ -50,7 +50,7 @@ new synthetics.Canary(stack, 'MyCanaryTwo', { handler: 'canary.handler', code: synthetics.Code.fromAsset(path.join(__dirname, 'canary.zip')), }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); new synthetics.Canary(stack, 'MyCanaryThree', { @@ -59,7 +59,7 @@ new synthetics.Canary(stack, 'MyCanaryThree', { handler: 'canary.handler', code: synthetics.Code.fromAsset(path.join(__dirname, 'canary.zip')), }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); new synthetics.Canary(stack, 'MyCanaryFour', { @@ -68,7 +68,7 @@ new synthetics.Canary(stack, 'MyCanaryFour', { handler: 'canary.handler', code: synthetics.Code.fromAsset(path.join(__dirname, 'canary.zip')), }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); new synthetics.Canary(stack, 'MyCanaryRuntime38', { @@ -77,7 +77,7 @@ new synthetics.Canary(stack, 'MyCanaryRuntime38', { handler: 'canary.handler', code: synthetics.Code.fromAsset(path.join(__dirname, 'canary.zip')), }), - runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9, }); new synthetics.Canary(stack, 'MyPythonCanary', { diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/canary-vpc.assets.json b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/canary-vpc.assets.json index c051e5d4c08d3..48638fc11184c 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/canary-vpc.assets.json +++ b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/canary-vpc.assets.json @@ -1,5 +1,5 @@ { - "version": "29.0.0", + "version": "30.0.0", "files": { "b1b777dcb79a2fa2790059927207d10bf5f4747d6dd1516e2780726d9d6fa820": { "source": { diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/cdk.out b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/cdk.out index d8b441d447f8a..ae4b03c54e770 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"29.0.0"} \ No newline at end of file +{"version":"30.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/integ.json b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/integ.json index 52cc3944c7f58..44b4a9563e17e 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "29.0.0", + "version": "30.0.0", "testCases": { "integ.vpc": { "stacks": [ diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/manifest.json b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/manifest.json index 9d34dcff3ea6c..481c908905b3b 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "29.0.0", + "version": "30.0.0", "artifacts": { "canary-vpc.assets": { "type": "cdk:asset-manifest", diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/tree.json b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/tree.json index 485c5796bc915..23303214be64f 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.js.snapshot/tree.json @@ -1048,7 +1048,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.228" + "version": "10.1.237" } } },