CfnCanary

class aws_cdk.aws_synthetics.CfnCanary(scope, id, *, 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: CfnResource

A CloudFormation AWS::Synthetics::Canary.

Creates or updates a canary. Canaries are scripts that monitor your endpoints and APIs from the outside-in. Canaries help you check the availability and latency of your web services and troubleshoot anomalies by investigating load time data, screenshots of the UI, logs, and metrics. You can set up a canary to run continuously or just once.

To create canaries, you must have the CloudWatchSyntheticsFullAccess policy. If you are creating a new IAM role for the canary, you also need the the iam:CreateRole , iam:CreatePolicy and iam:AttachRolePolicy permissions. For more information, see Necessary Roles and Permissions .

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

CloudformationResource:

AWS::Synthetics::Canary

Link:

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.
import aws_cdk.aws_synthetics as synthetics

cfn_canary = synthetics.CfnCanary(self, "MyCfnCanary",
    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"
    )
)

Create a new AWS::Synthetics::Canary.

Parameters:
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • 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[CodeProperty, Dict[str, Any], IResolvable]) – 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]) – AWS::Synthetics::Canary.DeleteLambdaResourcesOnCanaryDeletion.

  • 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 .

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters:

path (str) – The path of the value to delete.

Return type:

None

add_depends_on(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters:
  • key (str) –

  • value (Any) –

See:

Return type:

None

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters:
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type:

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters:

property_path (str) – The path to the property.

Return type:

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters:
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type:

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.

Return type:

None

get_att(attribute_name)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters:

attribute_name (str) – The name of the attribute.

Return type:

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters:

key (str) –

See:

Return type:

Any

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters:

inspector (TreeInspector) –

  • tree inspector to collect and process attributes.

Return type:

None

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters:

new_logical_id (str) – The new logical ID to use for this stack element.

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Returns:

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::Synthetics::Canary'
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.

Link:

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.

Link:

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

attr_code_source_location_arn

Ref returns the ARN of the Lambda layer where Synthetics stores the canary script code.

CloudformationAttribute:

Code.SourceLocationArn

attr_id

The ID of the canary.

CloudformationAttribute:

Id

attr_state

The state of the canary.

For example, RUNNING .

CloudformationAttribute:

State

cfn_options

Options for this resource, such as condition, update policy etc.

cfn_resource_type

AWS resource type.

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 .

Link:

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

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

delete_lambda_resources_on_canary_deletion

AWS::Synthetics::Canary.DeleteLambdaResourcesOnCanaryDeletion.

Link:

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

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

Link:

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.

Link:

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

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Returns:

the logical ID as a stringified token. This value will only get resolved during synthesis.

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 .

Link:

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

node

The construct tree node associated with this construct.

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

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.

Link:

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 .

Link:

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.

Link:

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

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

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.

Link:

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.

Link:

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.

Link:

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.

Link:

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 .

Link:

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

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters:

x (Any) –

Return type:

bool

Returns:

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(construct)

Check whether the given construct is a CfnResource.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

ArtifactConfigProperty

class CfnCanary.ArtifactConfigProperty(*, s3_encryption=None)

Bases: object

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

Parameters:

s3_encryption (Union[IResolvable, S3EncryptionProperty, Dict[str, Any], None]) – A structure that contains the configuration of the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3 . Artifact encryption functionality is available only for canaries that use Synthetics runtime version syn-nodejs-puppeteer-3.3 or later. For more information, see Encrypting canary artifacts .

Link:

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

ExampleMetadata:

fixture=_generated

Example:

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

artifact_config_property = synthetics.CfnCanary.ArtifactConfigProperty(
    s3_encryption=synthetics.CfnCanary.S3EncryptionProperty(
        encryption_mode="encryptionMode",
        kms_key_arn="kmsKeyArn"
    )
)

Attributes

s3_encryption

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

Artifact encryption functionality is available only for canaries that use Synthetics runtime version syn-nodejs-puppeteer-3.3 or later. For more information, see Encrypting canary artifacts .

Link:

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

BaseScreenshotProperty

class CfnCanary.BaseScreenshotProperty(*, screenshot_name, ignore_coordinates=None)

Bases: object

A structure representing a screenshot that is used as a baseline during visual monitoring comparisons made by the canary.

Parameters:
  • screenshot_name (str) – The name of the screenshot. This is generated the first time the canary is run after the UpdateCanary operation that specified for this canary to perform visual monitoring.

  • ignore_coordinates (Optional[Sequence[str]]) – Coordinates that define the part of a screen to ignore during screenshot comparisons. To obtain the coordinates to use here, use the CloudWatch console to draw the boundaries on the screen. For more information, see Edit or delete a canary .

Link:

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

ExampleMetadata:

fixture=_generated

Example:

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

base_screenshot_property = synthetics.CfnCanary.BaseScreenshotProperty(
    screenshot_name="screenshotName",

    # the properties below are optional
    ignore_coordinates=["ignoreCoordinates"]
)

Attributes

ignore_coordinates

Coordinates that define the part of a screen to ignore during screenshot comparisons.

To obtain the coordinates to use here, use the CloudWatch console to draw the boundaries on the screen. For more information, see Edit or delete a canary .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-basescreenshot.html#cfn-synthetics-canary-basescreenshot-ignorecoordinates

screenshot_name

The name of the screenshot.

This is generated the first time the canary is run after the UpdateCanary operation that specified for this canary to perform visual monitoring.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-basescreenshot.html#cfn-synthetics-canary-basescreenshot-screenshotname

CodeProperty

class CfnCanary.CodeProperty(*, handler, s3_bucket=None, s3_key=None, s3_object_version=None, script=None, source_location_arn=None)

Bases: object

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 .

Parameters:
  • handler (str) – 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* .

  • s3_bucket (Optional[str]) – If your canary script is located in S3, specify the bucket name here. The bucket must already exist.

  • s3_key (Optional[str]) – The S3 key of your script. For more information, see Working with Amazon S3 Objects .

  • s3_object_version (Optional[str]) – The S3 version ID of your script.

  • script (Optional[str]) – 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.

  • source_location_arn (Optional[str]) – The ARN of the Lambda layer where Synthetics stores the canary script code.

Link:

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

ExampleMetadata:

fixture=_generated

Example:

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

code_property = 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"
)

Attributes

handler

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* .

Link:

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

s3_bucket

If your canary script is located in S3, specify the bucket name here.

The bucket must already exist.

Link:

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

s3_key

The S3 key of your script.

For more information, see Working with Amazon S3 Objects .

Link:

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

s3_object_version

The S3 version ID of your script.

Link:

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

script

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.

Link:

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

source_location_arn

The ARN of the Lambda layer where Synthetics stores the canary script code.

Link:

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

RunConfigProperty

class CfnCanary.RunConfigProperty(*, active_tracing=None, environment_variables=None, memory_in_mb=None, timeout_in_seconds=None)

Bases: object

A structure that contains input information for a canary run.

This structure is required.

Parameters:
  • active_tracing (Union[bool, IResolvable, None]) – Specifies whether this canary is to use active AWS X-Ray tracing when it runs. Active tracing enables this canary run to be displayed in the ServiceLens and X-Ray service maps even if the canary does not hit an endpoint that has X-Ray tracing enabled. Using X-Ray tracing incurs charges. For more information, see Canaries and X-Ray tracing . You can enable active tracing only for canaries that use version syn-nodejs-2.0 or later for their canary runtime.

  • environment_variables (Union[IResolvable, Mapping[str, str], None]) – Specifies the keys and values to use for any environment variables used in the canary script. Use the following format: { “key1” : “value1”, “key2” : “value2”, …} Keys must start with a letter and be at least two characters. The total size of your environment variables cannot exceed 4 KB. You can’t specify any Lambda reserved environment variables as the keys for your environment variables. For more information about reserved keys, see Runtime environment variables .

  • memory_in_mb (Union[int, float, None]) – The maximum amount of memory that the canary can use while running. This value must be a multiple of 64. The range is 960 to 3008.

  • timeout_in_seconds (Union[int, float, None]) – How long the canary is allowed to run before it must stop. You can’t set this time to be longer than the frequency of the runs of this canary. If you omit this field, the frequency of the canary is used as this value, up to a maximum of 900 seconds.

Link:

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

ExampleMetadata:

fixture=_generated

Example:

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

run_config_property = synthetics.CfnCanary.RunConfigProperty(
    active_tracing=False,
    environment_variables={
        "environment_variables_key": "environmentVariables"
    },
    memory_in_mb=123,
    timeout_in_seconds=123
)

Attributes

active_tracing

Specifies whether this canary is to use active AWS X-Ray tracing when it runs.

Active tracing enables this canary run to be displayed in the ServiceLens and X-Ray service maps even if the canary does not hit an endpoint that has X-Ray tracing enabled. Using X-Ray tracing incurs charges. For more information, see Canaries and X-Ray tracing .

You can enable active tracing only for canaries that use version syn-nodejs-2.0 or later for their canary runtime.

Link:

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

environment_variables

Specifies the keys and values to use for any environment variables used in the canary script.

Use the following format:

{ “key1” : “value1”, “key2” : “value2”, …}

Keys must start with a letter and be at least two characters. The total size of your environment variables cannot exceed 4 KB. You can’t specify any Lambda reserved environment variables as the keys for your environment variables. For more information about reserved keys, see Runtime environment variables .

Link:

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

memory_in_mb

The maximum amount of memory that the canary can use while running.

This value must be a multiple of 64. The range is 960 to 3008.

Link:

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

timeout_in_seconds

How long the canary is allowed to run before it must stop.

You can’t set this time to be longer than the frequency of the runs of this canary.

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

Link:

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

S3EncryptionProperty

class CfnCanary.S3EncryptionProperty(*, encryption_mode=None, kms_key_arn=None)

Bases: object

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

Artifact encryption functionality is available only for canaries that use Synthetics runtime version syn-nodejs-puppeteer-3.3 or later. For more information, see Encrypting canary artifacts .

Parameters:
  • encryption_mode (Optional[str]) – The encryption method to use for artifacts created by this canary. Specify SSE_S3 to use server-side encryption (SSE) with an Amazon S3-managed key. Specify SSE-KMS to use server-side encryption with a customer-managed AWS KMS key. If you omit this parameter, an AWS -managed AWS KMS key is used.

  • kms_key_arn (Optional[str]) – The ARN of the customer-managed AWS KMS key to use, if you specify SSE-KMS for EncryptionMode.

Link:

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

ExampleMetadata:

fixture=_generated

Example:

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

s3_encryption_property = synthetics.CfnCanary.S3EncryptionProperty(
    encryption_mode="encryptionMode",
    kms_key_arn="kmsKeyArn"
)

Attributes

encryption_mode

The encryption method to use for artifacts created by this canary.

Specify SSE_S3 to use server-side encryption (SSE) with an Amazon S3-managed key. Specify SSE-KMS to use server-side encryption with a customer-managed AWS KMS key.

If you omit this parameter, an AWS -managed AWS KMS key is used.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-s3encryption.html#cfn-synthetics-canary-s3encryption-encryptionmode

kms_key_arn

The ARN of the customer-managed AWS KMS key to use, if you specify SSE-KMS for EncryptionMode.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-s3encryption.html#cfn-synthetics-canary-s3encryption-kmskeyarn

ScheduleProperty

class CfnCanary.ScheduleProperty(*, expression, duration_in_seconds=None)

Bases: object

This structure specifies how often a canary is to make runs and the date and time when it should stop making runs.

Parameters:
  • expression (str) – A rate expression or a cron expression that defines how often the canary is to run. For a rate expression, The syntax is rate( *number unit* ) . unit can be minute , minutes , or hour . For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour. You can specify a frequency between rate(1 minute) and rate(1 hour) . Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started. Use cron( *expression* ) to specify a cron expression. You can’t schedule a canary to wait for more than a year before running. For information about the syntax for cron expressions, see Scheduling canary runs using cron .

  • duration_in_seconds (Optional[str]) – How long, in seconds, for the canary to continue making regular runs according to the schedule in the Expression value. If you specify 0, the canary continues making runs until you stop it. If you omit this field, the default of 0 is used.

Link:

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

ExampleMetadata:

fixture=_generated

Example:

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

schedule_property = synthetics.CfnCanary.ScheduleProperty(
    expression="expression",

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

Attributes

duration_in_seconds

How long, in seconds, for the canary to continue making regular runs according to the schedule in the Expression value.

If you specify 0, the canary continues making runs until you stop it. If you omit this field, the default of 0 is used.

Link:

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

expression

A rate expression or a cron expression that defines how often the canary is to run.

For a rate expression, The syntax is rate( *number unit* ) . unit can be minute , minutes , or hour .

For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour. You can specify a frequency between rate(1 minute) and rate(1 hour) .

Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started.

Use cron( *expression* ) to specify a cron expression. You can’t schedule a canary to wait for more than a year before running. For information about the syntax for cron expressions, see Scheduling canary runs using cron .

Link:

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

VPCConfigProperty

class CfnCanary.VPCConfigProperty(*, security_group_ids, subnet_ids, vpc_id=None)

Bases: object

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 .

Parameters:
  • security_group_ids (Sequence[str]) – The IDs of the security groups for this canary.

  • subnet_ids (Sequence[str]) – The IDs of the subnets where this canary is to run.

  • vpc_id (Optional[str]) – The ID of the VPC where this canary is to run.

Link:

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

ExampleMetadata:

fixture=_generated

Example:

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

v_pCConfig_property = synthetics.CfnCanary.VPCConfigProperty(
    security_group_ids=["securityGroupIds"],
    subnet_ids=["subnetIds"],

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

Attributes

security_group_ids

The IDs of the security groups for this canary.

Link:

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

subnet_ids

The IDs of the subnets where this canary is to run.

Link:

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

vpc_id

The ID of the VPC where this canary is to run.

Link:

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

VisualReferenceProperty

class CfnCanary.VisualReferenceProperty(*, base_canary_run_id, base_screenshots=None)

Bases: object

Defines the screenshots to use as the baseline for comparisons during visual monitoring comparisons during future runs of this canary.

If you omit this parameter, no changes are made to any baseline screenshots that the canary might be using already.

Visual monitoring is supported only on canaries running the syn-puppeteer-node-3.2 runtime or later. For more information, see Visual monitoring and Visual monitoring blueprint

Parameters:
  • base_canary_run_id (str) – Specifies which canary run to use the screenshots from as the baseline for future visual monitoring with this canary. Valid values are nextrun to use the screenshots from the next run after this update is made, lastrun to use the screenshots from the most recent run before this update was made, or the value of Id in the CanaryRun from any past run of this canary.

  • base_screenshots (Union[IResolvable, Sequence[Union[IResolvable, BaseScreenshotProperty, Dict[str, Any]]], None]) – An array of screenshots that are used as the baseline for comparisons during visual monitoring.

Link:

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

ExampleMetadata:

fixture=_generated

Example:

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

visual_reference_property = 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"]
    )]
)

Attributes

base_canary_run_id

Specifies which canary run to use the screenshots from as the baseline for future visual monitoring with this canary.

Valid values are nextrun to use the screenshots from the next run after this update is made, lastrun to use the screenshots from the most recent run before this update was made, or the value of Id in the CanaryRun from any past run of this canary.

Link:

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

base_screenshots

An array of screenshots that are used as the baseline for comparisons during visual monitoring.

Link:

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