Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepController authored Oct 31, 2022
2 parents d9f3377 + 228c865 commit 4ffe8fc
Show file tree
Hide file tree
Showing 7 changed files with 548 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 @@ -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_7,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
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_7,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
});

// 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_7,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
});

// 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_7,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
});
```

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_7,
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8,
vpc,
});
```
Expand Down
17 changes: 17 additions & 0 deletions packages/@aws-cdk/aws-synthetics/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,27 @@ export class Runtime {
* - Puppeteer-core version 10.1.0
* - Chromium version 92.0.4512
*
* New Features:
* - **Logging enhancement**: The canary will upload logs to Amazon S3 even if it times out or crashes.
* - **Lambda layer size reduced**: The size of the Lambda layer used for canaries is reduced by 34%.
*
* @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-nodejs-puppeteer-3.8` includes the following:
* - Lambda runtime Node.js 14.x
* - Puppeteer-core version 10.1.0
* - Chromium version 92.0.4512
*
* New Features:
* - **Profile cleanup**: Chromium profiles are now cleaned up after each canary run.
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_nodejs_puppeteer.html#CloudWatch_Synthetics_runtimeversion-nodejs-puppeteer-3.8
*/
public static readonly SYNTHETICS_NODEJS_PUPPETEER_3_8 = new Runtime('syn-nodejs-puppeteer-3.8', 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 @@ -27,15 +27,15 @@
}
}
},
"38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d": {
"32cb6cc1550e67ae5e77eb85a64192d2aa44c328b778079b139e3965fb042575": {
"source": {
"path": "canary-one.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d.json",
"objectKey": "32cb6cc1550e67ae5e77eb85a64192d2aa44c328b778079b139e3965fb042575.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 @@ -925,6 +925,203 @@
"StartCanaryAfterCreation": true
}
},
"MyCanaryRuntime38ArtifactsBucket66BD74F0": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketEncryption": {
"ServerSideEncryptionConfiguration": [
{
"ServerSideEncryptionByDefault": {
"SSEAlgorithm": "aws:kms"
}
}
]
}
},
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"MyCanaryRuntime38ArtifactsBucketPolicy9D7ABC32": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "MyCanaryRuntime38ArtifactsBucket66BD74F0"
},
"PolicyDocument": {
"Statement": [
{
"Action": "s3:*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
},
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Resource": [
{
"Fn::GetAtt": [
"MyCanaryRuntime38ArtifactsBucket66BD74F0",
"Arn"
]
},
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"MyCanaryRuntime38ArtifactsBucket66BD74F0",
"Arn"
]
},
"/*"
]
]
}
]
}
],
"Version": "2012-10-17"
}
}
},
"MyCanaryRuntime38ServiceRole9FE5290C": {
"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": [
"MyCanaryRuntime38ArtifactsBucket66BD74F0",
"Arn"
]
}
},
{
"Action": "s3:PutObject",
"Effect": "Allow",
"Resource": {
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"MyCanaryRuntime38ArtifactsBucket66BD74F0",
"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"
}
]
}
},
"MyCanaryRuntime388C091D7C": {
"Type": "AWS::Synthetics::Canary",
"Properties": {
"ArtifactS3Location": {
"Fn::Join": [
"",
[
"s3://",
{
"Ref": "MyCanaryRuntime38ArtifactsBucket66BD74F0"
}
]
]
},
"Code": {
"Handler": "canary.handler",
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "b1b777dcb79a2fa2790059927207d10bf5f4747d6dd1516e2780726d9d6fa820.zip"
},
"ExecutionRoleArn": {
"Fn::GetAtt": [
"MyCanaryRuntime38ServiceRole9FE5290C",
"Arn"
]
},
"Name": "assetcanary-five",
"RuntimeVersion": "syn-nodejs-puppeteer-3.8",
"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
Expand Up @@ -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}/38dcc41263b1a009e2d7560d81dee9041f4f7941b66cd73b63df402a6fe3c22d.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/32cb6cc1550e67ae5e77eb85a64192d2aa44c328b778079b139e3965fb042575.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -153,6 +153,30 @@
"data": "MyCanaryFour15095F40"
}
],
"/canary-one/MyCanaryRuntime38/ArtifactsBucket/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyCanaryRuntime38ArtifactsBucket66BD74F0"
}
],
"/canary-one/MyCanaryRuntime38/ArtifactsBucket/Policy/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyCanaryRuntime38ArtifactsBucketPolicy9D7ABC32"
}
],
"/canary-one/MyCanaryRuntime38/ServiceRole/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyCanaryRuntime38ServiceRole9FE5290C"
}
],
"/canary-one/MyCanaryRuntime38/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyCanaryRuntime388C091D7C"
}
],
"/canary-one/MyPythonCanary/ArtifactsBucket/Resource": [
{
"type": "aws:cdk:logicalId",
Expand Down
Loading

0 comments on commit 4ffe8fc

Please sign in to comment.