aws-cdk-lib.aws_synthetics.CfnCanaryProps

interface CfnCanaryProps

LanguageType name
.NETAmazon.CDK.AWS.Synthetics.CfnCanaryProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awssynthetics#CfnCanaryProps
Javasoftware.amazon.awscdk.services.synthetics.CfnCanaryProps
Pythonaws_cdk.aws_synthetics.CfnCanaryProps
TypeScript aws-cdk-lib » aws_synthetics » CfnCanaryProps

Properties for defining a CfnCanary.

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 cfnCanaryProps: synthetics.CfnCanaryProps = {
  artifactS3Location: 'artifactS3Location',
  code: {
    handler: 'handler',

    // the properties below are optional
    s3Bucket: 's3Bucket',
    s3Key: 's3Key',
    s3ObjectVersion: 's3ObjectVersion',
    script: 'script',
    sourceLocationArn: 'sourceLocationArn',
  },
  executionRoleArn: 'executionRoleArn',
  name: 'name',
  runtimeVersion: 'runtimeVersion',
  schedule: {
    expression: 'expression',

    // the properties below are optional
    durationInSeconds: 'durationInSeconds',
  },

  // the properties below are optional
  artifactConfig: {
    s3Encryption: {
      encryptionMode: 'encryptionMode',
      kmsKeyArn: 'kmsKeyArn',
    },
  },
  deleteLambdaResourcesOnCanaryDeletion: false,
  failureRetentionPeriod: 123,
  runConfig: {
    activeTracing: false,
    environmentVariables: {
      environmentVariablesKey: 'environmentVariables',
    },
    memoryInMb: 123,
    timeoutInSeconds: 123,
  },
  startCanaryAfterCreation: false,
  successRetentionPeriod: 123,
  tags: [{
    key: 'key',
    value: 'value',
  }],
  visualReference: {
    baseCanaryRunId: 'baseCanaryRunId',

    // the properties below are optional
    baseScreenshots: [{
      screenshotName: 'screenshotName',

      // the properties below are optional
      ignoreCoordinates: ['ignoreCoordinates'],
    }],
  },
  vpcConfig: {
    securityGroupIds: ['securityGroupIds'],
    subnetIds: ['subnetIds'],

    // the properties below are optional
    vpcId: 'vpcId',
  },
};

Properties

NameTypeDescription
artifactS3LocationstringThe location in Amazon S3 where Synthetics stores artifacts from the runs of this canary.
codeIResolvable | CodePropertyUse this structure to input your script code for the canary.
executionRoleArnstringThe ARN of the IAM role to be used to run the canary.
namestringThe name for this canary.
runtimeVersionstringSpecifies the runtime version to use for the canary.
scheduleIResolvable | SchedulePropertyA structure that contains information about how often the canary is to run, and when these runs are to stop.
artifactConfig?IResolvable | ArtifactConfigPropertyA structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.
deleteLambdaResourcesOnCanaryDeletion?boolean | IResolvableAWS::Synthetics::Canary.DeleteLambdaResourcesOnCanaryDeletion.
failureRetentionPeriod?numberThe number of days to retain data about failed runs of this canary.
runConfig?IResolvable | RunConfigPropertyA structure that contains input information for a canary run.
startCanaryAfterCreation?boolean | IResolvableSpecify TRUE to have the canary start making runs immediately after it is created.
successRetentionPeriod?numberThe number of days to retain data about successful runs of this canary.
tags?CfnTag[]The list of key-value pairs that are associated with the canary.
visualReference?IResolvable | VisualReferencePropertyIf this canary performs visual monitoring by comparing screenshots, this structure contains the ID of the canary run to use as the baseline for screenshots, and the coordinates of any parts of the screen to ignore during the visual monitoring comparison.
vpcConfig?IResolvable | VPCConfigPropertyIf this canary is to test an endpoint in a VPC, this structure contains information about the subnet and security groups of the VPC endpoint.

artifactS3Location

Type: string

The location in Amazon S3 where Synthetics stores artifacts from the runs of this canary.

Artifacts include the log file, screenshots, and HAR files. Specify the full location path, including s3:// at the beginning of the path.


code

Type: IResolvable | 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 .


executionRoleArn

Type: string

The ARN of the IAM role to be used to run the canary.

This role must already exist, and must include lambda.amazonaws.com as a principal in the trust policy. The role must also have the following permissions:

  • s3:PutObject
  • s3:GetBucketLocation
  • s3:ListAllMyBuckets
  • cloudwatch:PutMetricData
  • logs:CreateLogGroup
  • logs:CreateLogStream
  • logs:PutLogEvents

name

Type: string

The name for this canary.

Be sure to give it a descriptive name that distinguishes it from other canaries in your account.

Do not include secrets or proprietary information in your canary names. The canary name makes up part of the canary ARN, and the ARN is included in outbound calls over the internet. For more information, see Security Considerations for Synthetics Canaries .


runtimeVersion

Type: string

Specifies the runtime version to use for the canary.

For more information about runtime versions, see Canary Runtime Versions .


schedule

Type: IResolvable | ScheduleProperty

A structure that contains information about how often the canary is to run, and when these runs are to stop.


artifactConfig?

Type: IResolvable | ArtifactConfigProperty (optional)

A structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.


deleteLambdaResourcesOnCanaryDeletion?

Type: boolean | IResolvable (optional)

AWS::Synthetics::Canary.DeleteLambdaResourcesOnCanaryDeletion.


failureRetentionPeriod?

Type: number (optional)

The number of days to retain data about failed runs of this canary.

If you omit this field, the default of 31 days is used. The valid range is 1 to 455 days.


runConfig?

Type: IResolvable | RunConfigProperty (optional)

A structure that contains input information for a canary run.

If you omit this structure, the frequency of the canary is used as canary's timeout value, up to a maximum of 900 seconds.


startCanaryAfterCreation?

Type: boolean | IResolvable (optional)

Specify TRUE to have the canary start making runs immediately after it is created.

A canary that you create using CloudFormation can't be used to monitor the CloudFormation stack that creates the canary or to roll back that stack if there is a failure.


successRetentionPeriod?

Type: number (optional)

The number of days to retain data about successful runs of this canary.

If you omit this field, the default of 31 days is used. The valid range is 1 to 455 days.


tags?

Type: CfnTag[] (optional)

The list of key-value pairs that are associated with the canary.


visualReference?

Type: IResolvable | VisualReferenceProperty (optional)

If this canary performs visual monitoring by comparing screenshots, this structure contains the ID of the canary run to use as the baseline for screenshots, and the coordinates of any parts of the screen to ignore during the visual monitoring comparison.


vpcConfig?

Type: IResolvable | VPCConfigProperty (optional)

If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and security groups of the VPC endpoint.

For more information, see Running a Canary in a VPC .