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

Create a trigger

  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 Service/Function.
  4. Find the required function in the required service and click the name of the function.
  5. Click the Triggers tab. On the tab, click Create Trigger.
  6. In the Create Trigger dialog box, enter the related information. Then click OK.
    Parameter Action Example
    Trigger Type Select Time Trigger. Time trigger
    Trigger Name Enter a trigger name. my_trigger
    Version/Alias Enter the version of the trigger. Default value: LATEST. For more information, see Introduction to versions. LATEST
    Time Settings Select one of the following configuration modes as needed.
    • Interval: Enter a positive integer n in this field. It indicates that the function will be triggered every n minutes.
    • Cron Expression: Enter a Cron expression in this field to trigger the function at the specified time. The standard Cron expression is in the following format: Seconds Minutes Hours Day-of-month Month Day-of-week.
      Note The Cron expression runs in Coordinated Universal Time (UTC). In other words, the time used in the Cron expression is the value obtained by subtracting 8 hours from the Beijing time.
    Interval: 5 minutes
    Enable Trigger Turn on Enable Trigger. Turn on the switch
    Event Payload Enter custom parameters.

    The Cron expression, Seconds Minutes Hours Day-of-month Month Day-of-week, is described as follows:

What to do next

  1. Define a function
  2. Debug a function