IBM Cloud Docs
Using Cloud Functions

Using Cloud Functions

With IBM Cloud® Functions, you can use your favorite programming language to write lightweight code that runs app logic in a scalable way. You can run code on-demand with HTTP-based API requests from applications or run code in response to IBM Cloud services and third-party events, like updates made to a bucket. The Function-as-a-Service (FaaS) programming platform is based on the open source project Apache OpenWhisk.

This feature is not currently supported in Object Storage for Satellite. Learn more.

Using Object Storage as an event source

Cloud Functions is an event-driven compute platform (also referred to as Serverless computing). Actions (small bits of code) run in response to triggers (some category of event), and rules associate certain actions with certain triggers. Configure IBM Cloud® Object Storage to be an event source, and anytime an object in a particular bucket is written or deleted an action is triggered. You can further tailor the changes feed to only corral events for objects which match a particular prefix or suffix.

  1. Set the option to allow Cloud Functions access to listen for changes that are made to your bucket. This involves creating a service-to-service authorization, and uses the new Notifications Manager IAM role.
  2. Then, create a trigger to respond to the changes feed.
  3. Then use the IBM Cloud Object Storage package to bind credentials and easily script common tasks.

For more information about using Cloud Functions with IBM Cloud Object Storage, see the Functions documentation.

It is not possible to use a bucket with a firewall enabled as an event source for IBM Cloud® Functions actions.

Next Steps

Be sure to identify the appropriate region and endpoint for your service. Then, verify your operations with specific testing.