aws-cdk-lib.aws_synthetics.CfnCanary.CodeProperty

interface CodeProperty

LanguageType name
.NETAmazon.CDK.AWS.Synthetics.CfnCanary.CodeProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awssynthetics#CfnCanary_CodeProperty
Javasoftware.amazon.awscdk.services.synthetics.CfnCanary.CodeProperty
Pythonaws_cdk.aws_synthetics.CfnCanary.CodeProperty
TypeScript aws-cdk-lib » 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 { aws_synthetics as synthetics } from 'aws-cdk-lib';
const codeProperty: synthetics.CfnCanary.CodeProperty = {
  handler: 'handler',

  // the properties below are optional
  s3Bucket: 's3Bucket',
  s3Key: 's3Key',
  s3ObjectVersion: 's3ObjectVersion',
  script: 'script',
  sourceLocationArn: 'sourceLocationArn',
};

Properties

NameTypeDescription
handlerstringThe entry point to use for the source code when running the canary.
s3Bucket?stringIf your canary script is located in S3, specify the bucket name here.
s3Key?stringThe S3 key of your script.
s3ObjectVersion?stringThe S3 version ID of your script.
script?stringIf 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.
sourceLocationArn?stringThe 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.