update_canary
¶
update_canary(
name: CanaryName,
*,
config_overrides: Optional[syntheticsClientConfig] = None,
code: Optional[CanaryCodeInput] = None,
execution_role_arn: Optional[RoleArn] = None,
runtime_version: Optional[String] = None,
schedule: Optional[CanaryScheduleInput] = None,
run_config: Optional[CanaryRunConfigInput] = None,
success_retention_period_in_days: Optional[MaxSize1024] = None,
failure_retention_period_in_days: Optional[MaxSize1024] = None,
vpc_config: Optional[VpcConfigInput] = None,
visual_reference: Optional[VisualReferenceInput] = None,
artifact_s3_location: Optional[String] = None,
artifact_config: Optional[ArtifactConfigInput] = None,
provisioned_resource_cleanup: Optional[ProvisionedResourceCleanupSetting] = None,
dry_run_id: Optional[UUID] = None,
visual_references: Optional[VisualReferences] = None,
browser_configs: Optional[BrowserConfigs] = None,
add_replica_locations: Optional[AddReplicaLocations] = None,
remove_replica_locations: Optional[RemoveReplicaLocations] = None,
kms_key_arn: Optional[KmsKeyArn] = None,
) -> UpdateCanaryResponse
Updates the configuration of a canary that has already been created.
For multibrowser canaries, you can add or remove browsers by updating the browserConfig list in the update call. For example:
-
To add Firefox to a canary that currently uses Chrome, specify browserConfigs as [CHROME, FIREFOX]
-
To remove Firefox and keep only Chrome, specify browserConfigs as [CHROME]
You can't use this operation to update the tags of an existing canary. To change the tags of an existing canary, use TagResource.
When you use the dryRunId field when updating a canary, the only other field you can provide is the Schedule. Adding any other field will thrown an exception.
Parameters:
-
name(CanaryName) –The name of the canary that you want to update. To find the names of your canaries, use DescribeCanaries.
You cannot change the name of a canary that has already been created.
-
code(Optional[CanaryCodeInput], default:None) –A structure that includes the entry point from which the canary should start running your script. If the script is stored in an Amazon S3 bucket, the bucket name, key, and version are also included.
-
execution_role_arn(Optional[RoleArn], default:None) –The ARN of the IAM role to be used to run the canary. This role must already exist, and must include
lambda.amazonaws.comas 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:CreateLogStream
-
-
runtime_version(Optional[String], default:None) –Specifies the runtime version to use for the canary. For a list of valid runtime versions and for more information about runtime versions, see Canary Runtime Versions.
-
schedule(Optional[CanaryScheduleInput], default:None) –A structure that contains information about how often the canary is to run, and when these runs are to stop.
-
run_config(Optional[CanaryRunConfigInput], default:None) –A structure that contains the timeout value that is used for each individual run of the canary.
Environment variable keys and values are encrypted at rest using Amazon Web Services owned KMS keys. However, the environment variables are not encrypted on the client side. Do not store sensitive information in them.
-
success_retention_period_in_days(Optional[MaxSize1024], default:None) –The number of days to retain data about successful runs of this canary.
This setting affects the range of information returned by GetCanaryRuns, as well as the range of information displayed in the Synthetics console.
-
failure_retention_period_in_days(Optional[MaxSize1024], default:None) –The number of days to retain data about failed runs of this canary.
This setting affects the range of information returned by GetCanaryRuns, as well as the range of information displayed in the Synthetics console.
-
vpc_config(Optional[VpcConfigInput], default: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.
-
visual_reference(Optional[VisualReferenceInput], default:None) –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
-
artifact_s3_location(Optional[String], default:None) –The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include the log file, screenshots, and HAR files. The name of the Amazon S3 bucket can't include a period (.).
-
artifact_config(Optional[ArtifactConfigInput], default: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.
-
provisioned_resource_cleanup(Optional[ProvisionedResourceCleanupSetting], default:None) –Specifies whether to also delete the Lambda functions and layers used by this canary when the canary is deleted.
If the value of this parameter is
OFF, then the value of theDeleteLambdaparameter of the DeleteCanary operation determines whether the Lambda functions and layers will be deleted. -
dry_run_id(Optional[UUID], default:None) –Update the existing canary using the updated configurations from the DryRun associated with the DryRunId.
When you use the
dryRunIdfield when updating a canary, the only other field you can provide is theSchedule. Adding any other field will thrown an exception. -
visual_references(Optional[VisualReferences], default:None) –A list of visual reference configurations for the canary, one for each browser type that the canary is configured to run on. Visual references are used for visual monitoring comparisons.
syn-nodejs-puppeteer-11.0and above, andsyn-nodejs-playwright-3.0and above, only supportsvisualReferences.visualReferencefield is not supported.Versions older than
syn-nodejs-puppeteer-11.0supports bothvisualReferenceandvisualReferencesfor backward compatibility. It is recommended to usevisualReferencesfor consistency and future compatibility.For multibrowser visual monitoring, you can update the baseline for all configured browsers in a single update call by specifying a list of VisualReference objects, one per browser. Each VisualReference object maps to a specific browser configuration, allowing you to manage visual baselines for multiple browsers simultaneously.
For single configuration canaries using Chrome browser (default browser), use visualReferences for
syn-nodejs-puppeteer-11.0and above, andsyn-nodejs-playwright-3.0and above canaries. The browserType in the visualReference object is not mandatory. -
browser_configs(Optional[BrowserConfigs], default:None) –A structure that specifies the browser type to use for a canary run. CloudWatch Synthetics supports running canaries on both
CHROMEandFIREFOXbrowsers.If not specified,
browserConfigsdefaults to Chrome. -
add_replica_locations(Optional[AddReplicaLocations], default:None) –A list of locations (Amazon Web Services Regions) to add as replicas for the canary. Each location specifies a Region and optional VPC configuration for the replica. You can add up to 50 replica locations.
-
remove_replica_locations(Optional[RemoveReplicaLocations], default:None) –A list of locations (Amazon Web Services Regions) to remove as replicas for the canary. You must specify at least one location to remove. All replicas can be removed in a single API call and you cannot remove the primary location.
-
kms_key_arn(Optional[KmsKeyArn], default:None) –The Amazon Resource Name (ARN) of the customer-managed AWS Key Management Service (AWS KMS) key used to encrypt the canary's AWS Lambda function environment variables at rest. If you don't specify a value, the service uses an AWS-managed key. If you omit this parameter, the service retains the existing value. To revert to the AWS-managed key, set this parameter to an empty string.
Raises:
-
AccessDeniedException–You don't have permission to perform this operation on this resource.
-
ConflictException–A conflicting operation is already in progress.
-
InternalServerException–An unknown internal error occurred.
-
RequestEntityTooLargeException–One of the input resources is larger than is allowed.
-
ResourceNotFoundException–One of the specified resources was not found.
-
ValidationException–A parameter could not be validated.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_synthetics/_services/synthetics.py
1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 | |