Skip to content

Commit

Permalink
feat(synthetics): Update Cloudwatch Synthetics canaries NodeJS runtim…
Browse files Browse the repository at this point in the history
…es (#11866)

Cloudwatch Synthetics recently released new NodeJS runtimes (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html).

This PR is adding them and update doc links

Fixes #11870

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
flochaz authored Jan 7, 2021
1 parent bf059fa commit 4f6e377
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-synthetics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const canary = new synthetics.Canary(this, 'MyCanary', {
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_2,
});
```

Expand Down Expand Up @@ -84,7 +84,7 @@ The canary will automatically produce a CloudWatch Dashboard:

![UI Screenshot](images/ui-screenshot.png)

The Canary code will be executed in a lambda function created by Synthetics on your behalf. The Lambda function includes a custom [runtime](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html) provided by Synthetics. The provided runtime includes a variety of handy tools such as [Puppeteer](https://www.npmjs.com/package/puppeteer-core) and Chromium. The default runtime is `syn-nodejs-2.0`.
The Canary code will be executed in a lambda function created by Synthetics on your behalf. The Lambda function includes a custom [runtime](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html) provided by Synthetics. The provided runtime includes a variety of handy tools such as [Puppeteer](https://www.npmjs.com/package/puppeteer-core) (for nodejs based one) and Chromium.

To learn more about Synthetics capabilities, check out the [docs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries.html).

Expand All @@ -107,7 +107,7 @@ const canary = new Canary(this, 'MyCanary', {
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
handler: 'index.handler', // must be 'index.handler'
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_2,
});

// To supply the code from your local filesystem:
Expand All @@ -116,7 +116,7 @@ const canary = new Canary(this, 'MyCanary', {
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
handler: 'index.handler', // must end with '.handler'
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_2,
});

// To supply the code from a S3 bucket:
Expand All @@ -125,7 +125,7 @@ const canary = new Canary(this, 'MyCanary', {
code: synthetics.Code.fromBucket(bucket, 'canary.zip'),
handler: 'index.handler', // must end with '.handler'
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_0,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_2_2,
});
```

Expand Down
27 changes: 24 additions & 3 deletions packages/@aws-cdk/aws-synthetics/lib/canary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,41 @@ export class Runtime {
* - Puppeteer-core version 1.14.0
* - The Chromium version that matches Puppeteer-core 1.14.0
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html#CloudWatch_Synthetics_runtimeversion-1.0
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-1.0
*/
public static readonly SYNTHETICS_1_0 = new Runtime('syn-1.0');

/**
* `syn-nodejs-2.0` includes the following:
* - Lambda runtime Node.js 10.x
* - Puppeteer-core version 3.3.0
* - Chromium version 81.0.4044.0
* - Chromium version 83.0.4103.0
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html#CloudWatch_Synthetics_runtimeversion-2.0
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-2.0
*/
public static readonly SYNTHETICS_NODEJS_2_0 = new Runtime('syn-nodejs-2.0');


/**
* `syn-nodejs-2.1` includes the following:
* - Lambda runtime Node.js 10.x
* - Puppeteer-core version 3.3.0
* - Chromium version 83.0.4103.0
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-2.1
*/
public static readonly SYNTHETICS_NODEJS_2_1 = new Runtime('syn-nodejs-2.1');

/**
* `syn-nodejs-2.2` includes the following:
* - Lambda runtime Node.js 10.x
* - Puppeteer-core version 3.3.0
* - Chromium version 83.0.4103.0
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-2.2
*/
public static readonly SYNTHETICS_NODEJS_2_2 = new Runtime('syn-nodejs-2.2');

/**
* @param name The name of the runtime version
*/
Expand Down

0 comments on commit 4f6e377

Please sign in to comment.