Skip to content

Commit

Permalink
feat(synthetics): runtime version syn-nodejs-puppeteer-3.7 (aws#22610)
Browse files Browse the repository at this point in the history
* adds a constant for nodejs runtime version 3.7
* Updated readme to use 3.7 because versions <= 3.4 are being deprecated 
* added a new integ test for 3.7 (and updated its snapshots)

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
pallymore authored and Naumel committed Oct 25, 2022
1 parent df36d45 commit 36f89f6
Show file tree
Hide file tree
Showing 9 changed files with 559 additions and 25 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 @@ -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_1,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_7,
environmentVariables: {
stage: 'prod',
},
Expand Down Expand Up @@ -129,7 +129,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_4,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_7,
});

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

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

Expand Down Expand Up @@ -188,7 +188,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_4,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_7,
vpc,
});
```
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 @@ -144,6 +144,16 @@ export class Runtime {
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_6 = new Runtime('syn-nodejs-puppeteer-3.6', RuntimeFamily.NODEJS);

/**
* `syn-nodejs-puppeteer-3.7` includes the following:
* - Lambda runtime Node.js 14.x
* - Puppeteer-core version 10.1.0
* - Chromium version 92.0.4512
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.7
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_7 = new Runtime('syn-nodejs-puppeteer-3.7', 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
@@ -1,5 +1,5 @@
{
"version": "20.0.0",
"version": "21.0.0",
"files": {
"9d00e437db1f5f8788ce938a3f00a9a1b946820e78c9b4c36207c8475db882bb": {
"source": {
Expand Down Expand Up @@ -27,15 +27,15 @@
}
}
},
"dd5cacd9987453c5d75cae0c956943b37b2fb0597ac6490e5b2e3eb1d0a5a6a0": {
"38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d": {
"source": {
"path": "canary-one.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "dd5cacd9987453c5d75cae0c956943b37b2fb0597ac6490e5b2e3eb1d0a5a6a0.json",
"objectKey": "38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,203 @@
"StartCanaryAfterCreation": true
}
},
"MyCanaryFourArtifactsBucketE259973B": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketEncryption": {
"ServerSideEncryptionConfiguration": [
{
"ServerSideEncryptionByDefault": {
"SSEAlgorithm": "aws:kms"
}
}
]
}
},
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"MyCanaryFourArtifactsBucketPolicy20BDB9D7": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "MyCanaryFourArtifactsBucketE259973B"
},
"PolicyDocument": {
"Statement": [
{
"Action": "s3:*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
},
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Resource": [
{
"Fn::GetAtt": [
"MyCanaryFourArtifactsBucketE259973B",
"Arn"
]
},
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"MyCanaryFourArtifactsBucketE259973B",
"Arn"
]
},
"/*"
]
]
}
]
}
],
"Version": "2012-10-17"
}
}
},
"MyCanaryFourServiceRoleA532F905": {
"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:GetBucketLocation",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"MyCanaryFourArtifactsBucketE259973B",
"Arn"
]
}
},
{
"Action": "s3:PutObject",
"Effect": "Allow",
"Resource": {
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"MyCanaryFourArtifactsBucketE259973B",
"Arn"
]
},
"/*"
]
]
}
},
{
"Action": "cloudwatch:PutMetricData",
"Condition": {
"StringEquals": {
"cloudwatch:namespace": "CloudWatchSynthetics"
}
},
"Effect": "Allow",
"Resource": "*"
},
{
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":logs:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":log-group:/aws/lambda/cwsyn-*"
]
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "canaryPolicy"
}
]
}
},
"MyCanaryFour15095F40": {
"Type": "AWS::Synthetics::Canary",
"Properties": {
"ArtifactS3Location": {
"Fn::Join": [
"",
[
"s3://",
{
"Ref": "MyCanaryFourArtifactsBucketE259973B"
}
]
]
},
"Code": {
"Handler": "canary.handler",
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "b1b777dcb79a2fa2790059927207d10bf5f4747d6dd1516e2780726d9d6fa820.zip"
},
"ExecutionRoleArn": {
"Fn::GetAtt": [
"MyCanaryFourServiceRoleA532F905",
"Arn"
]
},
"Name": "assetcanary-four",
"RuntimeVersion": "syn-nodejs-puppeteer-3.7",
"Schedule": {
"DurationInSeconds": "0",
"Expression": "rate(5 minutes)"
},
"StartCanaryAfterCreation": true
}
},
"MyPythonCanaryArtifactsBucket7AE88133": {
"Type": "AWS::S3::Bucket",
"Properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"20.0.0"}
{"version":"21.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "20.0.0",
"version": "21.0.0",
"testCases": {
"integ.canary": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "20.0.0",
"version": "21.0.0",
"artifacts": {
"Tree": {
"type": "cdk:tree",
Expand All @@ -23,7 +23,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dd5cacd9987453c5d75cae0c956943b37b2fb0597ac6490e5b2e3eb1d0a5a6a0.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -129,6 +129,30 @@
"data": "MyCanaryThree968B1271"
}
],
"/canary-one/MyCanaryFour/ArtifactsBucket/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyCanaryFourArtifactsBucketE259973B"
}
],
"/canary-one/MyCanaryFour/ArtifactsBucket/Policy/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyCanaryFourArtifactsBucketPolicy20BDB9D7"
}
],
"/canary-one/MyCanaryFour/ServiceRole/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyCanaryFourServiceRoleA532F905"
}
],
"/canary-one/MyCanaryFour/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyCanaryFour15095F40"
}
],
"/canary-one/MyPythonCanary/ArtifactsBucket/Resource": [
{
"type": "aws:cdk:logicalId",
Expand Down
Loading

0 comments on commit 36f89f6

Please sign in to comment.