UpdateCanary - Amazon CloudWatch Synthetics

UpdateCanary

Use this operation to change the settings of a canary that has already been created.

You can't use this operation to update the tags of an existing canary. To change the tags of an existing canary, use TagResource.

Request Syntax

PATCH /canary/name HTTP/1.1 Content-type: application/json { "Code": { "Handler": "string", "S3Bucket": "string", "S3Key": "string", "S3Version": "string", "ZipFile": blob }, "ExecutionRoleArn": "string", "FailureRetentionPeriodInDays": number, "RunConfig": { "ActiveTracing": boolean, "MemoryInMB": number, "TimeoutInSeconds": number }, "RuntimeVersion": "string", "Schedule": { "DurationInSeconds": number, "Expression": "string" }, "SuccessRetentionPeriodInDays": number, "VpcConfig": { "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 21.

Pattern: ^[0-9a-z_\-]+$

Required: Yes

Request Body

The request accepts the following data in JSON format.

Code

A structure that includes the entry point from which the canary should start running your script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included.

Type: CanaryCodeInput object

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.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 1024.

Required: No

RunConfig

A structure that contains the timeout value that is used for each individual run of the canary.

Type: CanaryRunConfigInput object

Required: No

RuntimeVersion

Specifies the runtime version to use for the canary. Currently, the only valid values are syn-nodejs-2.0, syn-nodejs-2.0-beta, and syn-1.0. 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.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 1024.

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.

ConflictException

A conflicting operation is already in progress.

HTTP Status Code: 409

InternalServerException

An unknown internal error occurred.

HTTP Status Code: 500

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: