interface CodeProperty
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Synthetics.CfnCanary.CodeProperty |
![]() | software.amazon.awscdk.services.synthetics.CfnCanary.CodeProperty |
![]() | aws_cdk.aws_synthetics.CfnCanary.CodeProperty |
![]() | @aws-cdk/aws-synthetics » CfnCanary » CodeProperty |
Use this structure to input your script code for the canary.
This structure contains the Lambda handler with the location where the canary should start running the script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included. If the script is passed into the canary directly, the script code is contained in the value of Script
.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as synthetics from '@aws-cdk/aws-synthetics';
const codeProperty: synthetics.CfnCanary.CodeProperty = {
handler: 'handler',
// the properties below are optional
s3Bucket: 's3Bucket',
s3Key: 's3Key',
s3ObjectVersion: 's3ObjectVersion',
script: 'script',
sourceLocationArn: 'sourceLocationArn',
};
Properties
Name | Type | Description |
---|---|---|
handler | string | The entry point to use for the source code when running the canary. |
s3 | string | If your canary script is located in S3, specify the bucket name here. |
s3 | string | The S3 key of your script. |
s3 | string | The S3 version ID of your script. |
script? | string | If you input your canary script directly into the canary instead of referring to an S3 location, the value of this parameter is the script in plain text. |
source | string | The ARN of the Lambda layer where Synthetics stores the canary script code. |
handler
Type:
string
The entry point to use for the source code when running the canary.
For canaries that use the syn-python-selenium-1.0
runtime or a syn-nodejs.puppeteer
runtime earlier than syn-nodejs.puppeteer-3.4
, the handler must be specified as *fileName* .handler
. For syn-python-selenium-1.1
, syn-nodejs.puppeteer-3.4
, and later runtimes, the handler can be specified as *fileName* . *functionName*
, or you can specify a folder where canary scripts reside as *folder* / *fileName* . *functionName*
.
s3Bucket?
Type:
string
(optional)
If your canary script is located in S3, specify the bucket name here.
The bucket must already exist.
s3Key?
Type:
string
(optional)
The S3 key of your script.
For more information, see Working with Amazon S3 Objects .
s3ObjectVersion?
Type:
string
(optional)
The S3 version ID of your script.
script?
Type:
string
(optional)
If you input your canary script directly into the canary instead of referring to an S3 location, the value of this parameter is the script in plain text.
It can be up to 5 MB.
sourceLocationArn?
Type:
string
(optional)
The ARN of the Lambda layer where Synthetics stores the canary script code.