CfnCanaryProps

class aws_cdk.aws_synthetics.CfnCanaryProps(*, artifact_s3_location, code, execution_role_arn, name, runtime_version, schedule, artifact_config=None, delete_lambda_resources_on_canary_deletion=None, failure_retention_period=None, run_config=None, start_canary_after_creation=None, success_retention_period=None, tags=None, visual_reference=None, vpc_config=None)

Bases: object

Properties for defining a CfnCanary.

Parameters:
  • artifact_s3_location (str) – 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 (Union[IResolvable, CodeProperty, Dict[str, Any]]) – 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 .

  • execution_role_arn (str) – 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 (str) – 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 .

  • runtime_version (str) – Specifies the runtime version to use for the canary. For more information about runtime versions, see Canary Runtime Versions .

  • schedule (Union[IResolvable, ScheduleProperty, Dict[str, Any]]) – A structure that contains information about how often the canary is to run, and when these runs are to stop.

  • artifact_config (Union[IResolvable, ArtifactConfigProperty, Dict[str, Any], None]) – A structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.

  • delete_lambda_resources_on_canary_deletion (Union[bool, IResolvable, None]) – (deprecated) Deletes associated lambda resources created by Synthetics if set to True. Default is False

  • failure_retention_period (Union[int, float, None]) – 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.

  • run_config (Union[IResolvable, RunConfigProperty, Dict[str, Any], None]) – 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.

  • start_canary_after_creation (Union[bool, IResolvable, None]) – 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.

  • success_retention_period (Union[int, float, None]) – 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 (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – The list of key-value pairs that are associated with the canary.

  • visual_reference (Union[IResolvable, VisualReferenceProperty, Dict[str, Any], None]) – 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.

  • vpc_config (Union[IResolvable, VPCConfigProperty, Dict[str, Any], None]) – 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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_synthetics as synthetics

cfn_canary_props = synthetics.CfnCanaryProps(
    artifact_s3_location="artifactS3Location",
    code=synthetics.CfnCanary.CodeProperty(
        handler="handler",

        # the properties below are optional
        s3_bucket="s3Bucket",
        s3_key="s3Key",
        s3_object_version="s3ObjectVersion",
        script="script",
        source_location_arn="sourceLocationArn"
    ),
    execution_role_arn="executionRoleArn",
    name="name",
    runtime_version="runtimeVersion",
    schedule=synthetics.CfnCanary.ScheduleProperty(
        expression="expression",

        # the properties below are optional
        duration_in_seconds="durationInSeconds"
    ),

    # the properties below are optional
    artifact_config=synthetics.CfnCanary.ArtifactConfigProperty(
        s3_encryption=synthetics.CfnCanary.S3EncryptionProperty(
            encryption_mode="encryptionMode",
            kms_key_arn="kmsKeyArn"
        )
    ),
    delete_lambda_resources_on_canary_deletion=False,
    failure_retention_period=123,
    run_config=synthetics.CfnCanary.RunConfigProperty(
        active_tracing=False,
        environment_variables={
            "environment_variables_key": "environmentVariables"
        },
        memory_in_mb=123,
        timeout_in_seconds=123
    ),
    start_canary_after_creation=False,
    success_retention_period=123,
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    visual_reference=synthetics.CfnCanary.VisualReferenceProperty(
        base_canary_run_id="baseCanaryRunId",

        # the properties below are optional
        base_screenshots=[synthetics.CfnCanary.BaseScreenshotProperty(
            screenshot_name="screenshotName",

            # the properties below are optional
            ignore_coordinates=["ignoreCoordinates"]
        )]
    ),
    vpc_config=synthetics.CfnCanary.VPCConfigProperty(
        security_group_ids=["securityGroupIds"],
        subnet_ids=["subnetIds"],

        # the properties below are optional
        vpc_id="vpcId"
    )
)

Attributes

artifact_config

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-artifactconfig

artifact_s3_location

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-artifacts3location

code

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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-code

delete_lambda_resources_on_canary_deletion

(deprecated) Deletes associated lambda resources created by Synthetics if set to True.

Default is False

Deprecated:

this property has been deprecated

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-deletelambdaresourcesoncanarydeletion

Stability:

deprecated

execution_role_arn

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-executionrolearn

failure_retention_period

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-failureretentionperiod

name

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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-name

run_config

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-runconfig

runtime_version

Specifies the runtime version to use for the canary.

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-runtimeversion

schedule

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-schedule

start_canary_after_creation

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-startcanaryaftercreation

success_retention_period

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-successretentionperiod

tags

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-tags

visual_reference

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-visualreference

vpc_config

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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-vpcconfig