Skip to content

Commit 228c865

Browse files
authored
feat(synthetics): aws synthetics runtime version syn-nodejs-puppeteer-3.8 (#22707)
adds new nodejs-puppeteer-runtime 3.8 support for aws-synthetics ---- ### 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*
1 parent fadbfc1 commit 228c865

File tree

7 files changed

+548
-8
lines changed

7 files changed

+548
-8
lines changed

packages/@aws-cdk/aws-synthetics/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const canary = new synthetics.Canary(this, 'MyCanary', {
4242
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
4343
handler: 'index.handler',
4444
}),
45-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_7,
45+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
4646
environmentVariables: {
4747
stage: 'prod',
4848
},
@@ -129,7 +129,7 @@ new synthetics.Canary(this, 'Inline Canary', {
129129
code: synthetics.Code.fromInline('/* Synthetics handler code */'),
130130
handler: 'index.handler', // must be 'index.handler'
131131
}),
132-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_7,
132+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
133133
});
134134

135135
// To supply the code from your local filesystem:
@@ -138,7 +138,7 @@ new synthetics.Canary(this, 'Asset Canary', {
138138
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
139139
handler: 'index.handler', // must end with '.handler'
140140
}),
141-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_7,
141+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
142142
});
143143

144144
// To supply the code from a S3 bucket:
@@ -149,7 +149,7 @@ new synthetics.Canary(this, 'Bucket Canary', {
149149
code: synthetics.Code.fromBucket(bucket, 'canary.zip'),
150150
handler: 'index.handler', // must end with '.handler'
151151
}),
152-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_7,
152+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
153153
});
154154
```
155155

@@ -188,7 +188,7 @@ new synthetics.Canary(this, 'Vpc Canary', {
188188
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
189189
handler: 'index.handler',
190190
}),
191-
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_7,
191+
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
192192
vpc,
193193
});
194194
```

packages/@aws-cdk/aws-synthetics/lib/runtime.ts

+17
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,27 @@ export class Runtime {
150150
* - Puppeteer-core version 10.1.0
151151
* - Chromium version 92.0.4512
152152
*
153+
* New Features:
154+
* - **Logging enhancement**: The canary will upload logs to Amazon S3 even if it times out or crashes.
155+
* - **Lambda layer size reduced**: The size of the Lambda layer used for canaries is reduced by 34%.
156+
*
153157
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.7
154158
*/
155159
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_7 = new Runtime('syn-nodejs-puppeteer-3.7', RuntimeFamily.NODEJS);
156160

161+
/**
162+
* `syn-nodejs-puppeteer-3.8` includes the following:
163+
* - Lambda runtime Node.js 14.x
164+
* - Puppeteer-core version 10.1.0
165+
* - Chromium version 92.0.4512
166+
*
167+
* New Features:
168+
* - **Profile cleanup**: Chromium profiles are now cleaned up after each canary run.
169+
*
170+
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.8
171+
*/
172+
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_8 = new Runtime('syn-nodejs-puppeteer-3.8', RuntimeFamily.NODEJS);
173+
157174
/**
158175
* `syn-python-selenium-1.0` includes the following:
159176
* - Lambda runtime Python 3.8

packages/@aws-cdk/aws-synthetics/test/canary.integ.snapshot/canary-one.assets.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
}
2828
}
2929
},
30-
"38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d": {
30+
"32cb6cc1550e67ae5e77eb85a64192d2aa44c328b778079b139e3965fb042575": {
3131
"source": {
3232
"path": "canary-one.template.json",
3333
"packaging": "file"
3434
},
3535
"destinations": {
3636
"current_account-current_region": {
3737
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
38-
"objectKey": "38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d.json",
38+
"objectKey": "32cb6cc1550e67ae5e77eb85a64192d2aa44c328b778079b139e3965fb042575.json",
3939
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
4040
}
4141
}

packages/@aws-cdk/aws-synthetics/test/canary.integ.snapshot/canary-one.template.json

+197
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,203 @@
925925
"StartCanaryAfterCreation": true
926926
}
927927
},
928+
"MyCanaryRuntime38ArtifactsBucket66BD74F0": {
929+
"Type": "AWS::S3::Bucket",
930+
"Properties": {
931+
"BucketEncryption": {
932+
"ServerSideEncryptionConfiguration": [
933+
{
934+
"ServerSideEncryptionByDefault": {
935+
"SSEAlgorithm": "aws:kms"
936+
}
937+
}
938+
]
939+
}
940+
},
941+
"UpdateReplacePolicy": "Retain",
942+
"DeletionPolicy": "Retain"
943+
},
944+
"MyCanaryRuntime38ArtifactsBucketPolicy9D7ABC32": {
945+
"Type": "AWS::S3::BucketPolicy",
946+
"Properties": {
947+
"Bucket": {
948+
"Ref": "MyCanaryRuntime38ArtifactsBucket66BD74F0"
949+
},
950+
"PolicyDocument": {
951+
"Statement": [
952+
{
953+
"Action": "s3:*",
954+
"Condition": {
955+
"Bool": {
956+
"aws:SecureTransport": "false"
957+
}
958+
},
959+
"Effect": "Deny",
960+
"Principal": {
961+
"AWS": "*"
962+
},
963+
"Resource": [
964+
{
965+
"Fn::GetAtt": [
966+
"MyCanaryRuntime38ArtifactsBucket66BD74F0",
967+
"Arn"
968+
]
969+
},
970+
{
971+
"Fn::Join": [
972+
"",
973+
[
974+
{
975+
"Fn::GetAtt": [
976+
"MyCanaryRuntime38ArtifactsBucket66BD74F0",
977+
"Arn"
978+
]
979+
},
980+
"/*"
981+
]
982+
]
983+
}
984+
]
985+
}
986+
],
987+
"Version": "2012-10-17"
988+
}
989+
}
990+
},
991+
"MyCanaryRuntime38ServiceRole9FE5290C": {
992+
"Type": "AWS::IAM::Role",
993+
"Properties": {
994+
"AssumeRolePolicyDocument": {
995+
"Statement": [
996+
{
997+
"Action": "sts:AssumeRole",
998+
"Effect": "Allow",
999+
"Principal": {
1000+
"Service": "lambda.amazonaws.com"
1001+
}
1002+
}
1003+
],
1004+
"Version": "2012-10-17"
1005+
},
1006+
"Policies": [
1007+
{
1008+
"PolicyDocument": {
1009+
"Statement": [
1010+
{
1011+
"Action": "s3:ListAllMyBuckets",
1012+
"Effect": "Allow",
1013+
"Resource": "*"
1014+
},
1015+
{
1016+
"Action": "s3:GetBucketLocation",
1017+
"Effect": "Allow",
1018+
"Resource": {
1019+
"Fn::GetAtt": [
1020+
"MyCanaryRuntime38ArtifactsBucket66BD74F0",
1021+
"Arn"
1022+
]
1023+
}
1024+
},
1025+
{
1026+
"Action": "s3:PutObject",
1027+
"Effect": "Allow",
1028+
"Resource": {
1029+
"Fn::Join": [
1030+
"",
1031+
[
1032+
{
1033+
"Fn::GetAtt": [
1034+
"MyCanaryRuntime38ArtifactsBucket66BD74F0",
1035+
"Arn"
1036+
]
1037+
},
1038+
"/*"
1039+
]
1040+
]
1041+
}
1042+
},
1043+
{
1044+
"Action": "cloudwatch:PutMetricData",
1045+
"Condition": {
1046+
"StringEquals": {
1047+
"cloudwatch:namespace": "CloudWatchSynthetics"
1048+
}
1049+
},
1050+
"Effect": "Allow",
1051+
"Resource": "*"
1052+
},
1053+
{
1054+
"Action": [
1055+
"logs:CreateLogGroup",
1056+
"logs:CreateLogStream",
1057+
"logs:PutLogEvents"
1058+
],
1059+
"Effect": "Allow",
1060+
"Resource": {
1061+
"Fn::Join": [
1062+
"",
1063+
[
1064+
"arn:",
1065+
{
1066+
"Ref": "AWS::Partition"
1067+
},
1068+
":logs:",
1069+
{
1070+
"Ref": "AWS::Region"
1071+
},
1072+
":",
1073+
{
1074+
"Ref": "AWS::AccountId"
1075+
},
1076+
":log-group:/aws/lambda/cwsyn-*"
1077+
]
1078+
]
1079+
}
1080+
}
1081+
],
1082+
"Version": "2012-10-17"
1083+
},
1084+
"PolicyName": "canaryPolicy"
1085+
}
1086+
]
1087+
}
1088+
},
1089+
"MyCanaryRuntime388C091D7C": {
1090+
"Type": "AWS::Synthetics::Canary",
1091+
"Properties": {
1092+
"ArtifactS3Location": {
1093+
"Fn::Join": [
1094+
"",
1095+
[
1096+
"s3://",
1097+
{
1098+
"Ref": "MyCanaryRuntime38ArtifactsBucket66BD74F0"
1099+
}
1100+
]
1101+
]
1102+
},
1103+
"Code": {
1104+
"Handler": "canary.handler",
1105+
"S3Bucket": {
1106+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
1107+
},
1108+
"S3Key": "b1b777dcb79a2fa2790059927207d10bf5f4747d6dd1516e2780726d9d6fa820.zip"
1109+
},
1110+
"ExecutionRoleArn": {
1111+
"Fn::GetAtt": [
1112+
"MyCanaryRuntime38ServiceRole9FE5290C",
1113+
"Arn"
1114+
]
1115+
},
1116+
"Name": "assetcanary-five",
1117+
"RuntimeVersion": "syn-nodejs-puppeteer-3.8",
1118+
"Schedule": {
1119+
"DurationInSeconds": "0",
1120+
"Expression": "rate(5 minutes)"
1121+
},
1122+
"StartCanaryAfterCreation": true
1123+
}
1124+
},
9281125
"MyPythonCanaryArtifactsBucket7AE88133": {
9291126
"Type": "AWS::S3::Bucket",
9301127
"Properties": {

packages/@aws-cdk/aws-synthetics/test/canary.integ.snapshot/manifest.json

+25-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"validateOnSynth": false,
2424
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
2525
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
26-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d.json",
26+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/32cb6cc1550e67ae5e77eb85a64192d2aa44c328b778079b139e3965fb042575.json",
2727
"requiresBootstrapStackVersion": 6,
2828
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2929
"additionalDependencies": [
@@ -153,6 +153,30 @@
153153
"data": "MyCanaryFour15095F40"
154154
}
155155
],
156+
"/canary-one/MyCanaryRuntime38/ArtifactsBucket/Resource": [
157+
{
158+
"type": "aws:cdk:logicalId",
159+
"data": "MyCanaryRuntime38ArtifactsBucket66BD74F0"
160+
}
161+
],
162+
"/canary-one/MyCanaryRuntime38/ArtifactsBucket/Policy/Resource": [
163+
{
164+
"type": "aws:cdk:logicalId",
165+
"data": "MyCanaryRuntime38ArtifactsBucketPolicy9D7ABC32"
166+
}
167+
],
168+
"/canary-one/MyCanaryRuntime38/ServiceRole/Resource": [
169+
{
170+
"type": "aws:cdk:logicalId",
171+
"data": "MyCanaryRuntime38ServiceRole9FE5290C"
172+
}
173+
],
174+
"/canary-one/MyCanaryRuntime38/Resource": [
175+
{
176+
"type": "aws:cdk:logicalId",
177+
"data": "MyCanaryRuntime388C091D7C"
178+
}
179+
],
156180
"/canary-one/MyPythonCanary/ArtifactsBucket/Resource": [
157181
{
158182
"type": "aws:cdk:logicalId",

0 commit comments

Comments
 (0)