Skip to content

Commit

Permalink
feat(synthetics): add syn-nodejs-puppeteer-3.3 runtime (#17132)
Browse files Browse the repository at this point in the history
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
msambol authored Oct 25, 2021
1 parent c36c73f commit 8343bec
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-synthetics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,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_1,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_3,
});

// To supply the code from your local filesystem:
Expand All @@ -136,7 +136,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_1,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_3,
});

// To supply the code from a S3 bucket:
Expand All @@ -147,7 +147,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_1,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_3,
});
```

Expand Down
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-synthetics/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ export class Runtime {
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_2 = new Runtime('syn-nodejs-puppeteer-3.2', RuntimeFamily.NODEJS);

/**
* `syn-nodejs-puppeteer-3.3` includes the following:
* - Lambda runtime Node.js 12.x
* - Puppeteer-core version 5.5.0
* - 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
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_3 = new Runtime('syn-nodejs-puppeteer-3.3', RuntimeFamily.NODEJS);

/**
* `syn-python-selenium-1.0` includes the following:
* - Lambda runtime Python 3.8
Expand Down
167 changes: 167 additions & 0 deletions packages/@aws-cdk/aws-synthetics/test/integ.canary.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,173 @@
"StartCanaryAfterCreation": true
}
},
"MyCanaryThreeArtifactsBucket894E857E": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketEncryption": {
"ServerSideEncryptionConfiguration": [
{
"ServerSideEncryptionByDefault": {
"SSEAlgorithm": "aws:kms"
}
}
]
}
},
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"MyCanaryThreeServiceRole68117E65": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"Policies": [
{
"PolicyDocument": {
"Statement": [
{
"Action": "s3:ListAllMyBuckets",
"Effect": "Allow",
"Resource": "*"
},
{
"Action": [
"s3:PutObject",
"s3:GetBucketLocation"
],
"Effect": "Allow",
"Resource": {
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"MyCanaryThreeArtifactsBucket894E857E",
"Arn"
]
},
"/*"
]
]
}
},
{
"Action": "cloudwatch:PutMetricData",
"Condition": {
"StringEquals": {
"cloudwatch:namespace": "CloudWatchSynthetics"
}
},
"Effect": "Allow",
"Resource": "*"
},
{
"Action": [
"logs:CreateLogStream",
"logs:CreateLogGroup",
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":logs:::*"
]
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "canaryPolicy"
}
]
}
},
"MyCanaryThree968B1271": {
"Type": "AWS::Synthetics::Canary",
"Properties": {
"ArtifactS3Location": {
"Fn::Join": [
"",
[
"s3://",
{
"Ref": "MyCanaryThreeArtifactsBucket894E857E"
}
]
]
},
"Code": {
"Handler": "canary.handler",
"S3Bucket": {
"Ref": "AssetParametersb1b777dcb79a2fa2790059927207d10bf5f4747d6dd1516e2780726d9d6fa820S3Bucket705C3761"
},
"S3Key": {
"Fn::Join": [
"",
[
{
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "AssetParametersb1b777dcb79a2fa2790059927207d10bf5f4747d6dd1516e2780726d9d6fa820S3VersionKeyE546342B"
}
]
}
]
},
{
"Fn::Select": [
1,
{
"Fn::Split": [
"||",
{
"Ref": "AssetParametersb1b777dcb79a2fa2790059927207d10bf5f4747d6dd1516e2780726d9d6fa820S3VersionKeyE546342B"
}
]
}
]
}
]
]
}
},
"ExecutionRoleArn": {
"Fn::GetAtt": [
"MyCanaryThreeServiceRole68117E65",
"Arn"
]
},
"Name": "assetcanary-three",
"RuntimeVersion": "syn-nodejs-puppeteer-3.3",
"Schedule": {
"DurationInSeconds": "0",
"Expression": "rate(5 minutes)"
},
"StartCanaryAfterCreation": true
}
},
"MyPythonCanaryArtifactsBucket7AE88133": {
"Type": "AWS::S3::Bucket",
"Properties": {
Expand Down
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-synthetics/test/integ.canary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as synthetics from '../lib';
* -- aws synthetics get-canary --name canary-integ has a state of 'RUNNING'
* -- aws synthetics get-canary --name assetcanary-one has a state of 'RUNNING'
* -- aws synthetics get-canary --name assetcanary-two has a state of 'RUNNING'
* -- aws synthetics get-canary --name assetcanary-three has a state of 'RUNNING'
*/
const app = new cdk.App();
const stack = new cdk.Stack(app, 'canary-one');
Expand Down Expand Up @@ -50,6 +51,15 @@ new synthetics.Canary(stack, 'MyCanaryTwo', {
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_2,
});

new synthetics.Canary(stack, 'MyCanaryThree', {
canaryName: 'assetcanary-three',
test: synthetics.Test.custom({
handler: 'canary.handler',
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary.zip')),
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_3,
});

new synthetics.Canary(stack, 'MyPythonCanary', {
canaryName: 'py-canary-integ',
test: synthetics.Test.custom({
Expand Down

0 comments on commit 8343bec

Please sign in to comment.