This topic describes how to create a time trigger in the Function Compute console to trigger a function every five minutes.


  1. Log on to the Function Compute console.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Services and Functions.
  4. In the Services pane, click the service that you require. On the Functions tab, click the name of the function that you require.
  5. Click the Triggers tab. Then, click Create Trigger.
  6. In the Create Trigger panel, enter the relevant information. Then, click OK.
    Parameter Configuration method Example
    Trigger Type Select Time Trigger. Time Trigger
    Trigger Name Enter a custom trigger name. my_trigger
    Version/Alias Enter the version of the trigger. Default value: LATEST. For more information, see Introduction to versions. LATEST
    Timer Settings Select one of the following configuration modes as needed.
    • Interval: Enter a positive integer n in this field. It indicates that the function is triggered every n minutes.
    • Cron Expression: Enter a CRON expression in this field to trigger the function at the specified time.
    Interval: 5 Minutes
    Enable Trigger Turn on Enable Trigger. Turn on the switch
    Event Payload Enter custom parameters. The trigger message is used as the value of the payload parameter in the event. For more information about the event format, see the Event format section of the Define a function topic.
    Time expressions
    • CRON expression

      The CRON expression uses Coordinated Universal Time (UTC). The standard CRON expression is in the following format: Seconds Minutes Hours Day-of-month Month Day-of-week.

    • Time zone expression

      If you want to trigger a function based on a specific time zone, you can use the CRON_TZ expression. For example, if you want to trigger the function at 04:00 on the first day of every month (UTC+8), you can use CRON_TZ=Asia/Shanghai 0 0 4 1 * *. The time zone expression varies with the region.


      If your time zone uses summer time and winter time, the function may be scheduled more or fewer times than expected during the changes between summer time and winter time. We recommend that you set the scheduling time outside of the change periods.

    The following table describes common examples of time expressions. For example, if you want a function in Function Compute to be triggered at 12:00 (UTC+8), the CRON expression is 0 0 4 * * *, and the time zone expression is CRON_TZ=Asia/Shanghai 0 0 12 * * *.
    Example CRON expression Time zone expression
    Schedule the function at 12:00 every day 0 0 4 * * * CRON_TZ=Asia/Shanghai 0 0 12 * * *
    Schedule the function at 12:30 every day 0 30 4 * * * CRON_TZ=Asia/Shanghai 0 30 12 * * *
    Schedule the function at the 26th, 29th, and 33rd minutes in each hour 0 26,29,33 * * * * CRON_TZ=Asia/Shanghai 0 26,29,33 * * * *
    Schedule the function at 12:30 every day from Monday to Friday 0 30 4 ? * MON-FRI CRON_TZ=Asia/Shanghai 0 30 12 ? * MON-FRI
    Schedule the function every 5 minutes from 12:00 to 14:00 every day from Monday to Friday 0 0/5 4-6 ? * MON-FRI CRON_TZ=Asia/Shanghai 0 0/5 12-14 ? * MON-FRI
    Schedule the function at 12:00 every day from January to April 0 0 4 ? JAN,FEB,MAR,APR * CRON_TZ=Asia/Shanghai 0 0 12 ? JAN,FEB,MAR,APR *
    The following table describes the fields of the CRON expression.
    • Fields
      Field Value range Allowed special character
      Seconds 0 to 59 N/A
      Minutes 0 to 59 , - * /
      Hours 0 to 23 , - * /
      Day-of-month 1 to 31 , - * ? /
      Month 1 to 12 or JAN to DEC , - * /
      Day-of-week 1 to 7 or MON to SUN , - * ?
    • Special characters
      Character Description Example
      * Indicates any or each. In the Minutes field, 0 indicates that the function is triggered at the 0th second of every minute.
      , Indicates a value list. In the Day-of-week field, MON,WED,FRI indicates Monday, Wednesday, and Friday.
      - Indicates a range. In the Hours field, 10-12 indicates the UTC time from 10:00 to 12:00.
      ? Indicates an uncertain value. This special character is used with other specified values. For example, if you specify a specific date, but you do not care what day of the week it is, you can use this special character in the Day-of-week field.
      / Indicates the increment of a value. For example, n/m means to add an increment m to n each time. In the minute field, 3/5 indicates that the function is triggered every 5 minutes starting from the 3rd minute.
    You can view the created trigger in the trigger list. create-timer-trigger

What to do next

  1. Define a function
  2. Debug a function