ScheduleExpression

class aws_cdk.aws_scheduler_alpha.ScheduleExpression

Bases: object

(experimental) ScheduleExpression for EventBridge Schedule.

You can choose from three schedule types when configuring your schedule: rate-based, cron-based, and one-time schedules. Both rate-based and cron-based schedules are recurring schedules.

See:

https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html

Stability:

experimental

ExampleMetadata:

infused

Example:

import aws_cdk.aws_kinesisfirehose as firehose
# delivery_stream: firehose.CfnDeliveryStream


payload = {
    "Data": "record"
}

Schedule(self, "Schedule",
    schedule=ScheduleExpression.rate(Duration.minutes(60)),
    target=targets.KinesisDataFirehosePutRecord(delivery_stream,
        input=ScheduleTargetInput.from_object(payload)
    )
)
Stability:

experimental

Attributes

expression_string

(experimental) Retrieve the expression for this schedule.

Stability:

experimental

time_zone

(experimental) Retrieve the expression for this schedule.

Stability:

experimental

Static Methods

classmethod at(date, time_zone=None)

(experimental) Construct a one-time schedule from a date.

Parameters:
  • date (datetime) – The date and time to use. The millisecond part will be ignored.

  • time_zone (Optional[TimeZone]) – The time zone to use for interpreting the date. Default: - UTC

Stability:

experimental

Return type:

ScheduleExpression

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

(experimental) Create a recurring schedule from a set of cron fields and time zone.

Parameters:
  • time_zone (Optional[TimeZone]) – (experimental) The timezone to run the schedule in. Default: - TimeZone.ETC_UTC

  • 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

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

Stability:

experimental

Return type:

ScheduleExpression

classmethod expression(expression, time_zone=None)

(experimental) Construct a schedule from a literal schedule expression.

Parameters:
  • expression (str) – The expression to use. Must be in a format that EventBridge will recognize

  • time_zone (Optional[TimeZone]) – The time zone to use for interpreting the expression. Default: - UTC

Stability:

experimental

Return type:

ScheduleExpression

classmethod rate(duration)

(experimental) Construct a recurring schedule from an interval and a time unit.

Rates may be defined with any unit of time, but when converted into minutes, the duration must be a positive whole number of minutes.

Parameters:

duration (Duration) –

Stability:

experimental

Return type:

ScheduleExpression