interface CanaryProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Synthetics.CanaryProps |
Java | software.amazon.awscdk.services.synthetics.CanaryProps |
Python | aws_cdk.aws_synthetics.CanaryProps |
TypeScript (source) | @aws-cdk/aws-synthetics » CanaryProps |
Properties for a canary.
Example
const canary = new synthetics.Canary(this, 'MyCanary', {
schedule: synthetics.Schedule.rate(Duration.minutes(5)),
test: synthetics.Test.custom({
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')),
handler: 'index.handler',
}),
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_1,
environmentVariables: {
stage: 'prod',
},
});
Properties
Name | Type | Description |
---|---|---|
runtime | Runtime | Specify the runtime version to use for the canary. |
test | Test | The type of test that you want your canary to run. |
artifacts | Artifacts | The s3 location that stores the data of the canary runs. |
canary | string | The name of the canary. |
environment | { [string]: string } | Key-value pairs that the Synthetics caches and makes available for your canary scripts. |
failure | Duration | How many days should failed runs be retained. |
role? | IRole | Canary execution role. |
schedule? | Schedule | Specify the schedule for how often the canary runs. |
security | ISecurity [] | The list of security groups to associate with the canary's network interfaces. |
start | boolean | Whether or not the canary should start after creation. |
success | Duration | How many days should successful runs be retained. |
time | Duration | How long the canary will be in a 'RUNNING' state. |
vpc? | IVpc | The VPC where this canary is run. |
vpc | Subnet | Where to place the network interfaces within the VPC. |
runtime
Type:
Runtime
Specify the runtime version to use for the canary.
test
Type:
Test
The type of test that you want your canary to run.
Use Test.custom()
to specify the test to run.
artifactsBucketLocation?
Type:
Artifacts
(optional, default: A new s3 bucket will be created without a prefix.)
The s3 location that stores the data of the canary runs.
canaryName?
Type:
string
(optional, default: A unique name will be generated from the construct ID)
The name of the 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 name. The canary name makes up part of the canary ARN, which is included in outbound calls over the internet.
environmentVariables?
Type:
{ [string]: string }
(optional, default: No environment variables.)
Key-value pairs that the Synthetics caches and makes available for your canary scripts.
Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Canary script source code.
failureRetentionPeriod?
Type:
Duration
(optional, default: Duration.days(31))
How many days should failed runs be retained.
role?
Type:
IRole
(optional, default: A unique role will be generated for this canary.
You can add permissions to roles by calling 'addToRolePolicy'.)
Canary execution role.
This is the role that will be assumed by the canary upon execution. It controls the permissions that the canary will have. The role must be assumable by the AWS Lambda service principal.
If not supplied, a role will be created with all the required permissions. If you provide a Role, you must add the required permissions.
See also: [required permissions: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-executionrolearn](required permissions: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-executionrolearn)
schedule?
Type:
Schedule
(optional, default: 'rate(5 minutes)')
Specify the schedule for how often the canary runs.
For example, if you set schedule
to rate(10 minutes)
, then the canary will run every 10 minutes.
You can set the schedule with Schedule.rate(Duration)
(recommended) or you can specify an expression using Schedule.expression()
.
securityGroups?
Type:
ISecurity
[]
(optional, default: If the canary is placed within a VPC and a security group is
not specified a dedicated security group will be created for this canary.)
The list of security groups to associate with the canary's network interfaces.
You must provide vpc
when using this prop.
startAfterCreation?
Type:
boolean
(optional, default: true)
Whether or not the canary should start after creation.
successRetentionPeriod?
Type:
Duration
(optional, default: Duration.days(31))
How many days should successful runs be retained.
timeToLive?
Type:
Duration
(optional, default: no limit)
How long the canary will be in a 'RUNNING' state.
For example, if you set timeToLive
to be 1 hour and schedule
to be rate(10 minutes)
,
your canary will run at 10 minute intervals for an hour, for a total of 6 times.
vpc?
Type:
IVpc
(optional, default: Not in VPC)
The VPC where this canary is run.
Specify this if the canary needs to access resources in a VPC.
vpcSubnets?
Type:
Subnet
(optional, default: the Vpc default strategy if not specified)
Where to place the network interfaces within the VPC.
You must provide vpc
when using this prop.