Schedule

class aws_cdk.aws_synthetics.Schedule(*args: Any, **kwargs)

Bases: object

Schedule for canary runs.

ExampleMetadata:

infused

Example:

canary = synthetics.Canary(self, "MyCanary",
    schedule=synthetics.Schedule.rate(Duration.minutes(5)),
    test=synthetics.Test.custom(
        code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
        handler="index.handler"
    ),
    runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2,
    environment_variables={
        "stage": "prod"
    }
)

Attributes

expression_string

The Schedule expression.

Static Methods

classmethod cron(*, day=None, hour=None, minute=None, month=None, week_day=None)

Create a schedule from a set of cron fields.

Parameters:
  • day (Optional[str]) – The day of the month to run this rule at. Default: - Every day of the month

  • hour (Optional[str]) – The hour to run this rule at. Default: - Every hour

  • minute (Optional[str]) – The minute to run this rule at. Default: - Every minute

  • month (Optional[str]) – The month to run this rule at. Default: - Every month

  • week_day (Optional[str]) – The day of the week to run this rule at. Default: - Any day of the week

Return type:

Schedule

classmethod expression(expression)

Construct a schedule from a literal schedule expression.

The expression must be in a rate(number units) format. For example, Schedule.expression('rate(10 minutes)')

Parameters:

expression (str) – The expression to use.

Return type:

Schedule

classmethod once()

The canary will be executed once.

Return type:

Schedule

classmethod rate(interval)

Construct a schedule from an interval.

Allowed values: 0 (for a single run) or between 1 and 60 minutes. To specify a single run, you can use Schedule.once().

Parameters:

interval (Duration) – The interval at which to run the canary.

Return type:

Schedule