Updated on 2023-11-06 GMT+08:00

Using a Timer Trigger

For details about the timer event source, see Supported Event Sources.

Prerequisites

You have created a function. For details, see Creating a Function from Scratch.

Creating a Timer Trigger

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the function to be configured to go to the function details page.
  3. Choose Configuration > Triggers and click Create Trigger.

    Figure 1 Creating a trigger

  4. Set the following parameters:

    • Trigger Type: Select Timer.
    • Timer Name: Enter a timer name, for example, Timer.
    • Rule: Set a fixed rate or a cron expression.
      • Fixed rate: The function is triggered at a fixed rate of minutes, hours, or days. You can set a fixed rate from 1 to 60 minutes, 1 to 24 hours, or 1 to 30 days.
      • Cron expression: The function is triggered based on a complex rule. For example, you can set a function to be executed at 08:30:00 from Monday to Friday. For more information, see Cron Expressions for a Function Timer Trigger.
    • Enable Trigger: Choose whether to enable the timer trigger.
    • Additional Information: The additional information you configure will be put into the user_event field of the timer event source. For details, see Supported Event Sources.

  5. Click OK.

Viewing the Execution Result

After the timer trigger is created, the function is executed every 1 minute. To view the function running logs, perform the following steps:

  1. Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click a function to go to the function details page.
  3. Choose Monitoring > Logs to query function running logs.