Skip to content

Commit

Permalink
feat(synthetics): support runtime 3.9 (#24101)
Browse files Browse the repository at this point in the history
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*
  • Loading branch information
rix0rrr authored Feb 12, 2023
1 parent 4c72a7d commit 9d23cad
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 33 deletions.
16 changes: 8 additions & 8 deletions packages/@aws-cdk/aws-synthetics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down Expand Up @@ -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,
});
```

Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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,
});
```

Expand All @@ -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
Expand All @@ -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,
});
```
Expand Down
19 changes: 19 additions & 0 deletions packages/@aws-cdk/aws-synthetics/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -1355,4 +1355,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -2049,4 +2049,4 @@
"version": "0.0.0"
}
}
}
}
12 changes: 6 additions & 6 deletions packages/@aws-cdk/aws-synthetics/test/integ.canary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand All @@ -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,
});

Expand All @@ -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', {
Expand All @@ -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', {
Expand All @@ -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', {
Expand All @@ -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', {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "30.0.0",
"files": {
"b1b777dcb79a2fa2790059927207d10bf5f4747d6dd1516e2780726d9d6fa820": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"29.0.0"}
{"version":"30.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "30.0.0",
"testCases": {
"integ.vpc": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "30.0.0",
"artifacts": {
"canary-vpc.assets": {
"type": "cdk:asset-manifest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@
"path": "Tree",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.228"
"version": "10.1.237"
}
}
},
Expand Down

0 comments on commit 9d23cad

Please sign in to comment.