Let me be honest, right up front: Google Cloud Functions are amazing. I just spent the last several months immersed in them so I could bring you the Google Cloud Functions Deep Dive, and I’m blown away by their flexibility, ease-of-use, and potential. I’ve long been a fan and advocate of system integration: the more you can leverage separate services to work together toward a common goal, the better. And Cloud Functions are the digital glue that not only binds various Google Cloud services (like Cloud Pub/Sub and Cloud IoT Core) but also allows those same services to call on third-party APIs, including those from GitHub, Slack, and Twilio. This allows their functionality to fully collaborate, either with each other or with the vast array of Google Cloud services.
A Use-Case Example
I’ll give you an example of the coolness of Cloud Functions by describing one of Use Cases: Gathering and Converting Visual Information (for more, check out the course here). This use case steps you through harnessing Cloud Functions along with sophisticated Google Cloud machine learning APIs to automatically scan uploaded photos for any embedded text, extract it, and translate it into 5 different languages. Sound cool? Let me tell you how it works.
How It Works
First, an image is uploaded to a Google Cloud Storage bucket. Cloud Functions can automatically detect a number of operations with buckets, including a new object being placed in one. The upload triggers the first of three Cloud Functions; one of the neat things about this lesson is that it shows you how to work with multiple Cloud Functions in the same code file.
This first Cloud Function calls the Google Cloud Vision API to examine the image for any text. If text is found, the API extracts it and sends it on to Cloud Pub/Sub. Pub/Sub is also tightly integrated with Cloud Functions and the posting of a message to a specific topic triggers the second function. This function calls upon another Google AI API, Translate. The Translate API then, at the direction of the function, outputs the text found in the image in five different languages and submits it in another Cloud Pub/Sub message. This action—you guessed it—triggers our third and final Cloud Function which takes the five translations and stores them in a different Cloud Storage bucket.
Want to find out exactly how this and many other automated operations can take place? Join me in Google Cloud Functions Deep Dive to understand the potential that this integral service brings to the Google Cloud platform.