This topic describes how to create an Object Storage Service (OSS) event trigger in the Function Compute console.

Prerequisites

  1. Create service
  2. Create function
  3. Create buckets
    Note The OSS bucket and your function must be in the same region.

Create a trigger

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select your region.
  3. In the left-side navigation pane, click Service/Function.
  4. Find the target function in the target service and click the name of the function.
  5. On the page that appears, click the Triggers tab. On the tab, click Create Trigger.
    create_trigger
  6. In the Create Trigger dialog box, enter the related information. Then click OK.
    Parameter Description
    Trigger Type Select Object Storage Service (OSS).
    Trigger Name Enter a name for the custom trigger.
    Version/Alias Enter a version or an alias for the trigger. Default value: LATEST. For more information, see Introduction to versions.
    Bucket Select the created OSS bucket.
    Events Select an event. For more information, see Definition of OSS events.

    ObjectCreated:PutObject is selected in this example.

    Trigger Rule Enter the prefix and suffix for the trigger rule. For information about the precautions, seeTrigger rules.
    Role Operation
    1. Select Quick Authorize from the drop-down list.
    2. Click Authorize.
    3. On the page that appears, click Confirm Authorization Policy.

    The trigger role is AliyunOSSEventNotificationRole.

    You can view the created trigger in the trigger list.create-trigger-result

What to do next

  1. Define a function
  2. Test a function