An Object Storage Service (OSS) event trigger can automatically trigger a function when an OSS event occurs, and then perform custom data processing in OSS based on your function logic. This topic uses an example where a function is triggered when an image is stored into an OSS bucket, to describe how to configure an OSS event trigger.

Scenario

You can configure an OSS event trigger and set the prefix to source/ in the trigger rule. When an image is stored in the source/ directory of a specified OSS bucket, a function is automatically triggered, which will zoom in or out and store the image in the processed/ directory of the same bucket. Specifically, source/serverless.png is processed into processed/serverless.png.

Configure a trigger

Function Compute allows you to configure a trigger in multiple ways: