Time-based scheduling

Updated at:

When workflows need to run on a recurring basis -- such as nightly data syncs, periodic health checks, or monthly report generation -- manually triggering each execution is impractical. Time-based scheduling in CloudFlow automates workflow execution at fixed intervals or specific times using cron expressions, with EventBridge handling the trigger infrastructure.

Prerequisites

Before you begin, make sure that you have:

Create a time-based schedule

  1. Log on to the CloudFlow console. In the top navigation bar, select a region.

  2. On the Workflows page, click the target workflow.

  3. On the Workflow Details page, click the Workflow Scheduling tab, and then click Create Workflow Scheduling.

  4. In the Create Workflow Scheduling panel, select Scheduled Trigger from the Scheduling Type drop-down list, configure the following parameters, and then click OK.

    Parameter

    Description

    Example

    Name

    A name for the schedule.

    schedule-test

    Description

    A brief description of the schedule.

    test schedule

    Trigger Cycle

    The scheduling mode. See Fixed Cycle vs. Custom Cron for details.

    Select Fixed Cycle, set Cycle Type to Second and Cycle to 30. The workflow runs every 30 seconds.

    Trigger Message

    A custom JSON payload passed to the workflow at each trigger.

    {"key": "value"}

    Note

    The first time you create a schedule, attach the AliyunEventBridgeFullAccess policy to the CloudFlow scheduling role and activate EventBridge.

  5. After the schedule is created, manage it from the Workflow Scheduling tab. Available actions: view, edit, delete, enable, and disable.

Fixed Cycle vs. Custom Cron

CloudFlow supports two scheduling modes through the Trigger Cycle parameter:

Mode

When to use

How it works

Fixed Cycle

Simple recurring intervals (every N seconds, minutes, or hours)

Select a Cycle Type (Second, Minute, or Hour) and a Cycle value. No cron knowledge required.

Custom Cron

Specific times, weekday-only schedules, or complex patterns

Write a cron expression for precise control. See Cron expression reference.

Scheduling parameters

Each time-based schedule consists of three parameters:

{
    "UserData": "payload",
    "Schedule": "cronExpression",
    "TimeZone": "GMT+0:00"
}

Parameter

Description

UserData

Input payload for the workflow, specified as a JSON object.

Schedule

Cron expression that defines when the workflow runs.

TimeZone

Time zone for schedule evaluation. Default: GMT+0:00 (UTC+0). For example, Beijing time is GMT+8:00.

Cron expression reference

A cron expression uses six space-separated fields:

Seconds Minutes Hours Day-of-month Month Day-of-week

Field definitions

Field

Valid values

Allowed special characters

Seconds

0-59

, - * /

Minutes

0-59

, - * /

Hours

0-23

, - * /

Day-of-month

1-31

, - * ? / L W

Month

1-12 or JAN-DEC

, - * /

Day-of-week

1-7 or SUN-SAT

, - * ? / L #

Special characters

Character

Meaning

Example

*

Every value in the field.

* in Minutes: runs every minute.

,

A list of values.

MON,WED,FRI in Day-of-week: Monday, Wednesday, and Friday.

-

A range of values.

10-12 in Hours: 10:00 through 12:00.

?

No specific value. Use in Day-of-month or Day-of-week when the other field is specified.

? in Day-of-week when Day-of-month is 15.

/

An increment. n/m means starting at n, repeat every m.

3/5 in Minutes: every 5 minutes starting at minute 3.

L

Last. In Day-of-month, the last day of the month. In Day-of-week, prefix with a day number for the last occurrence.

6L: the last Friday of the month.

W

Nearest weekday (Monday through Friday).

1W in Day-of-month: the first business day of the month.

#

The nth weekday of the month.

6#3: the third Friday of the month.

Common examples

All examples below use the GMT+8:00 time zone.

Schedule

Cron expression

Time zone

Every day at 12:00

0 0 12 * * ?

GMT+8:00

Every day at 12:30

0 30 12 * * ?

GMT+8:00

At the 26th, 29th, and 33rd minute of every hour

0 26,29,33 * * * ?

GMT+8:00

Weekdays at 12:30

0 30 12 ? * MON-FRI

GMT+8:00

Every 5 minutes from 12:00 to 14:00 on weekdays

0 0/5 12-14 ? * MON-FRI

GMT+8:00

Every day at 12:00, January through April

0 0 12 ? JAN,FEB,MAR,APR *

GMT+8:00

Every Wednesday in March at 14:10 and 14:44

0 10,44 14 ? 3 WED

GMT+8:00

Last day of each month at 23:00

0 0 23 L * ?

GMT+8:00

Last Friday of each month at 10:15

0 15 10 ? * 6L

GMT+8:00

Third Friday of each month at 10:15

0 15 10 ? * 6#3

GMT+8:00

Example: To run a workflow at 12:00 Beijing time every day, set the cron expression to 0 0 12 * * ? and the time zone to GMT+8:00.

Input format

When a schedule triggers a workflow, CloudFlow passes a CloudEvents-compliant JSON payload as input:

{
    "datacontenttype": "application/json;charset=utf-8",
    "aliyunaccountid": "143998900779****",
    "aliyunpublishtime": "2022-09-21T05:00:00.035Z",
    "data": {
        "TimeZone": "GMT+0:00",
        "Schedule": "0/30 * * * * ?",
        "UserData": {
            "key": "value"
        }
    },
    "specversion": "1.0",
    "aliyuneventbusname": "Housekeeping-Bus",
    "id": "d100262d-90c7-4caf-a3b5-813f3526a1f7-****",
    "source": "housekeeping.scheduledevent",
    "time": "2022-09-21T05:00:00Z",
    "aliyunregionid": "cn-beijing",
    "type": "eventbridge:Events:ScheduledEvent"
}

The following table describes the fields in the data object. The remaining fields are standard CloudEvents envelope fields populated by EventBridge.

Field

Description

UserData

Custom input specified in the schedule configuration. Access this value in a flow definition with $Input.data.UserData. For details, see Inputs and outputs.

Schedule

Cron expression that triggered the execution.

TimeZone

Time zone configured for the schedule. Default: GMT+0:00.

Limits

Time-based scheduling relies on EventBridge custom event buses and event rules. If either resource reaches its quota within your Alibaba Cloud account and region, new schedules cannot be created. For quota details, see Limits.