All Products
Search
Document Center

Overview

Last Updated: Oct 16, 2018

In this sample, you can learn how to connect Object Storage Service (OSS) with Function Compute by using OSS triggers. It assumes that you have signed up for Function Compute and OSS.

Why this solution?

In some cases, you may not want to call functions directly. For example, an application may have used Object Storage Service (OSS) to store images that you have uploaded. In this case, you can use a function to download and process the images and store the processing results in OSS or other services. If OSS can detect incremental images and automatically call the corresponding function, you do not need to call the function manually. The development and application processes are simplified.

After you create an OSS trigger for a function, the relevant OSS event triggers the function.

In this example, a file prefixed with source/ and stored in the specified OSS bucket can call the resize function automatically. This function scales the image and stores the processing result in the processed/ directory of the same bucket. For example, the function processes source/serverless.png as processed/serverless.png.

Contents

  1. Create OSS bucket.
  2. Create function.
  3. Test function.
  4. Configure OSS trigger.

Reference

OSS triggers