What's New

IBM Cloud Functions Adds Support for Cloud Object Storage Triggers

Share this post:

What’s new with IBM Cloud Functions and Cloud Object Storage triggers?

Starting today in the US-South region, IBM Cloud Functions allows you to create triggers based on Cloud Object Storage bucket changes. With the new /whisk.system/cos-experimental package, you can create triggers and rules to fire actions when bucket objects are created, modified, or deleted. This package is currently an experimental offering. You can try out this new feature and provide feedback related to desired feature enhancements or problems you encounter.

A new Cloud Object Storage package

The existing /whisk.system/cloud-object-storage package is joined by the /whisk.system/cos-experimental package. The former package continues to provide convenient actions you can use to access your Cloud Object Storage instance, while the cos-experimental package introduces a feed action that is used during trigger creation to configure bucket-specific events.

Let’s put this to work

Before starting, you must have a Cloud Object Storage service instance created and running in the IBM Cloud. This instance should have at least one bucket as well as a service credential containing the API key used to access your storage. You should also know the endpoint that was used to create the bucket; Cloud Functions will use this endpoint to determine bucket changes.

  1. Create a package binding:
    ibmcloud fn package bind /whisk.system/cos-experimental myCosPkg
  2. Bind your Cloud Object Storage credentials to your package binding:
    ibmcloud fn service bind cloud-object-storage myCosPkg
  3. Create a trigger. Replace myBucket with your bucket name, and use your bucket’s endpoint value:
    ibmcloud fn trigger create myCosTrigger --feed myCosPkg/changes -p bucket myBucket -p endpoint s3.us-south.cloud-object-storage.appdomain.cloud
  4. Create a rule to run your action when the trigger fires. Replace myCosChangeAction with one of your actions:
    ibmcloud fn rule create myCosRule myCosTrigger myCosChangeAction
  5. In your Cloud Object Storage dashboard, either modify an existing object or create a new one.
  6. Observe the trigger being fired. Run the following command a few times over the span of about one minute (the default bucket polling interval):
    ibmcloud fn activation list

Going further

The cos-experimental event provider also easily integrates with the existing actions defined in the cloud-object-storage package; you can create rules that run those actions when a bucket is updated. For more information about this feature, refer to the IBM Cloud Functions Documentation.

Bluemix OpenWhisk Development

More What's New stories
May 3, 2019

Kubernetes Tutorials: 5 Ways to Get You Building Fast

Ready to start working with Kubernetes? Want to build your Kubernetes skills? The five tutorials in this post will teach you everything you need to know about how to manage your containerized apps with Kubernetes.

Continue reading

May 3, 2019

Using Portworx to Deploy and Manage an HA MySQL Cluster on IBM Cloud Kubernetes Service

This tutorial is a walkthrough of the steps involved in deploying and managing a highly available MySQL cluster on IBM Cloud Kubernetes Service.

Continue reading

May 2, 2019

Kubernetes v1.14.1 Now Available in IBM Cloud Kubernetes Service

We are excited to announce the availability of Kubernetes v1.14.1 for your clusters that are running in IBM Cloud Kubernetes Service. IBM Cloud Kubernetes Service continues to be the first public managed Kubernetes service to support the latest upstream versions from the community.

Continue reading