Skip to main content

canaries

Creates, updates, deletes or gets a canary resource or lists canaries in a region

Overview

Namecanaries
TypeResource
DescriptionResource Type definition for AWS::Synthetics::Canary
Idaws.synthetics.canaries

Fields

NameDatatypeDescription
namestringName of the canary.
idstringId of the canary
statestringState of the canary
codeobjectProvide the canary script source
artifact_s3_locationstringProvide the s3 bucket output location for test results
artifact_configobjectProvide artifact configuration
scheduleobjectFrequency to run your canaries
execution_role_arnstringLambda Execution role used to run your canaries
runtime_versionstringRuntime version of Synthetics Library
success_retention_periodintegerRetention period of successful canary runs represented in number of days
failure_retention_periodintegerRetention period of failed canary runs represented in number of days
tagsarray
vpc_configobjectProvide VPC Configuration if enabled.
run_configobjectProvide canary run configuration
start_canary_after_creationbooleanRuns canary if set to True. Default is False
visual_referenceobjectVisual reference configuration for visual testing
delete_lambda_resources_on_canary_deletionbooleanDeletes associated lambda resources created by Synthetics if set to True. Default is False
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTName, Code, ArtifactS3Location, ExecutionRoleArn, Schedule, RuntimeVersion, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all canaries in a region.

SELECT
region,
name,
id,
state,
code,
artifact_s3_location,
artifact_config,
schedule,
execution_role_arn,
runtime_version,
success_retention_period,
failure_retention_period,
tags,
vpc_config,
run_config,
start_canary_after_creation,
visual_reference,
delete_lambda_resources_on_canary_deletion
FROM aws.synthetics.canaries
WHERE region = 'us-east-1';

Gets all properties from an individual canary.

SELECT
region,
name,
id,
state,
code,
artifact_s3_location,
artifact_config,
schedule,
execution_role_arn,
runtime_version,
success_retention_period,
failure_retention_period,
tags,
vpc_config,
run_config,
start_canary_after_creation,
visual_reference,
delete_lambda_resources_on_canary_deletion
FROM aws.synthetics.canaries
WHERE region = 'us-east-1' AND data__Identifier = '<Name>';

INSERT example

Use the following StackQL query and manifest file to create a new canary resource, using stack-deploy.

/*+ create */
INSERT INTO aws.synthetics.canaries (
Name,
Code,
ArtifactS3Location,
Schedule,
ExecutionRoleArn,
RuntimeVersion,
region
)
SELECT
'{{ Name }}',
'{{ Code }}',
'{{ ArtifactS3Location }}',
'{{ Schedule }}',
'{{ ExecutionRoleArn }}',
'{{ RuntimeVersion }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.synthetics.canaries
WHERE data__Identifier = '<Name>'
AND region = 'us-east-1';

Permissions

To operate on the canaries resource, the following permissions are required:

Create

synthetics:CreateCanary,
synthetics:StartCanary,
synthetics:GetCanary,
synthetics:TagResource,
s3:CreateBucket,
s3:GetObject,
s3:GetObjectVersion,
s3:PutBucketEncryption,
s3:PutEncryptionConfiguration,
s3:GetBucketLocation,
lambda:CreateFunction,
lambda:AddPermission,
lambda:PublishVersion,
lambda:UpdateFunctionConfiguration,
lambda:GetFunctionConfiguration,
lambda:GetLayerVersionByArn,
lambda:GetLayerVersion,
lambda:PublishLayerVersion,
ec2:DescribeVpcs,
ec2:DescribeSubnets,
ec2:DescribeSecurityGroups,
iam:PassRole

Update

synthetics:UpdateCanary,
synthetics:StartCanary,
synthetics:StopCanary,
synthetics:GetCanary,
synthetics:TagResource,
synthetics:UntagResource,
s3:GetObject,
s3:GetObjectVersion,
s3:PutBucketEncryption,
s3:PutEncryptionConfiguration,
s3:GetBucketLocation,
lambda:AddPermission,
lambda:PublishVersion,
lambda:UpdateFunctionConfiguration,
lambda:GetFunctionConfiguration,
lambda:GetLayerVersionByArn,
lambda:GetLayerVersion,
lambda:PublishLayerVersion,
iam:PassRole

Read

synthetics:GetCanary,
synthetics:DescribeCanaries,
synthetics:ListTagsForResource,
iam:ListRoles,
s3:ListAllMyBuckets,
s3:GetBucketLocation

Delete

synthetics:DeleteCanary,
synthetics:GetCanary

List

synthetics:DescribeCanaries