UpdateCanary
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.
Note
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.
Request Syntax
PATCH /canary/name
HTTP/1.1
Content-type: application/json
{
"ArtifactConfig": {
"S3Encryption": {
"EncryptionMode": "string
",
"KmsKeyArn": "string
"
}
},
"ArtifactS3Location": "string
",
"BrowserConfigs": [
{
"BrowserType": "string
"
}
],
"Code": {
"Dependencies": [
{
"Reference": "string
",
"Type": "string
"
}
],
"Handler": "string
",
"S3Bucket": "string
",
"S3Key": "string
",
"S3Version": "string
",
"ZipFile": blob
},
"DryRunId": "string
",
"ExecutionRoleArn": "string
",
"FailureRetentionPeriodInDays": number
,
"ProvisionedResourceCleanup": "string
",
"RunConfig": {
"ActiveTracing": boolean
,
"EnvironmentVariables": {
"string
" : "string
"
},
"EphemeralStorage": number
,
"MemoryInMB": number
,
"TimeoutInSeconds": number
},
"RuntimeVersion": "string
",
"Schedule": {
"DurationInSeconds": number
,
"Expression": "string
",
"RetryConfig": {
"MaxRetries": number
}
},
"SuccessRetentionPeriodInDays": number
,
"VisualReference": {
"BaseCanaryRunId": "string
",
"BaseScreenshots": [
{
"IgnoreCoordinates": [ "string
" ],
"ScreenshotName": "string
"
}
],
"BrowserType": "string
"
},
"VisualReferences": [
{
"BaseCanaryRunId": "string
",
"BaseScreenshots": [
{
"IgnoreCoordinates": [ "string
" ],
"ScreenshotName": "string
"
}
],
"BrowserType": "string
"
}
],
"VpcConfig": {
"Ipv6AllowedForDualStack": boolean
,
"SecurityGroupIds": [ "string
" ],
"SubnetIds": [ "string
" ]
}
}
URI Request Parameters
The request uses the following URI parameters.
- name
-
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.
Length Constraints: Minimum length of 1. Maximum length of 255.
Pattern:
^[0-9a-z_\-]+$
Required: Yes
Request Body
The request accepts the following data in JSON format.
- ArtifactConfig
-
A structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.
Type: ArtifactConfigInput object
Required: No
- ArtifactS3Location
-
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 (.).
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: No
- BrowserConfigs
-
A structure that specifies the browser type to use for a canary run. CloudWatch Synthetics supports running canaries on both
CHROME
andFIREFOX
browsers.Note
If not specified,
browserConfigs
defaults to Chrome.Type: Array of BrowserConfig objects
Array Members: Minimum number of 1 item. Maximum number of 2 items.
Required: No
- Code
-
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.
Type: CanaryCodeInput object
Required: No
- DryRunId
-
Update the existing canary using the updated configurations from the DryRun associated with the DryRunId.
Note
When you use the
dryRunId
field when updating a canary, the only other field you can provide is theSchedule
. Adding any other field will thrown an exception.Type: String
Pattern:
^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
Required: No
- ExecutionRoleArn
-
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:CreateLogStream
Type: String
Length Constraints: Minimum length of 1. Maximum length of 2048.
Pattern:
arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+
Required: No
-
- FailureRetentionPeriodInDays
-
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.
Type: Integer
Valid Range: Minimum value of 1. Maximum value of 1024.
Required: No
- ProvisionedResourceCleanup
-
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 theDeleteLambda
parameter of the DeleteCanary operation determines whether the Lambda functions and layers will be deleted.Type: String
Valid Values:
AUTOMATIC | OFF
Required: No
- RunConfig
-
A structure that contains the timeout value that is used for each individual run of the canary.
Important
Environment variable keys and values are encrypted at rest using AWS owned AWS KMS keys. However, the environment variables are not encrypted on the client side. Do not store sensitive information in them.
Type: CanaryRunConfigInput object
Required: No
- RuntimeVersion
-
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.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: No
- Schedule
-
A structure that contains information about how often the canary is to run, and when these runs are to stop.
Type: CanaryScheduleInput object
Required: No
- SuccessRetentionPeriodInDays
-
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.
Type: Integer
Valid Range: Minimum value of 1. Maximum value of 1024.
Required: No
- VisualReference
-
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
Type: VisualReferenceInput object
Required: No
- VisualReferences
-
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.0
and above, andsyn-nodejs-playwright-3.0
and above, only supportsvisualReferences
.visualReference
field is not supported.Versions older than
syn-nodejs-puppeteer-11.0
supports bothvisualReference
andvisualReferences
for backward compatibility. It is recommended to usevisualReferences
for 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.0
and above, andsyn-nodejs-playwright-3.0
and above canaries. The browserType in the visualReference object is not mandatory.Type: Array of VisualReferenceInput objects
Array Members: Minimum number of 1 item. Maximum number of 2 items.
Required: No
- VpcConfig
-
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.
Type: VpcConfigInput object
Required: No
Response Syntax
HTTP/1.1 200
Response Elements
If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
You don't have permission to perform this operation on this resource.
HTTP Status Code: 403
- ConflictException
-
A conflicting operation is already in progress.
HTTP Status Code: 409
- InternalServerException
-
An unknown internal error occurred.
HTTP Status Code: 500
- RequestEntityTooLargeException
-
One of the input resources is larger than is allowed.
HTTP Status Code: 413
- ResourceNotFoundException
-
One of the specified resources was not found.
HTTP Status Code: 404
- ValidationException
-
A parameter could not be validated.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: