What is Cloud Function in GCP

How Cloud Functions Works


Google Cloud Functions is a serverless event-driven managed platform for building and connecting cloud services.



  • Cloud Functions is a serverless service, which means that the underlying infrastructure is automatically allocated as needed.
  • This cloud service is event-driven.
  • Cloud Functions is a fully managed platform.
  • Google Cloud handles pretty much everything for you. All you need to provide is the actual function.
  • The primary benefit is that Cloud Functions connects and extends services.
  • No server management, no provisioning, no configuring, no maintaining.
  • Benefit of being serverless is that scaling on-demand, whether up or down, is automatic.
  • Because Cloud Functions is all about the code, you only pay for when that code executes.
  • The code is available in a wide range of flavors, including Node.js, Python, Go, Java, .NET, Ruby, and PHP.


General Cloud Functions workflow.

  • The event triggers a Cloud Function.
  • The code in the Cloud Function executes
  • Outputs a result.



Workflow  Example

  • First an image is uploaded to a Cloud Storage bucket
  • That action in the Cloud Storage triggers a Cloud Function.
  • When the function is executed, it calls the Vision API.
  • The Vision API extracts the text from the message and posts its results in a Pub/Sub topic, which in turn, triggers another Cloud Function.
  • This particular function calls Cloud Translate, and that API translates the extracted text.
  • The API stores its results in a different Pub/Sub topic, which triggers our third and final Cloud Function.
  • And this Cloud Function saves the results in a different Cloud Storage bucket.

GCP, Accenture, Hytechie, AlgaeStudy, AlgaeServices

Here we see 3 different Cloud Functions, linking together 4 different services numerous times. It's worth noting that the code for all the functions in this workflow can be contained in a single file.

Cloud Function can play a part in especially when it comes to connecting and expanding existing services, both on and off the Google Cloud Platform.


Cloud Functions can integrate with those services off GCP, and it's all done through 

  • Available APIs:

    • Applications programming interfaces. APIs, such as those from GitHub, Slack, and Twilio.
    • Mobile backends. Cloud Functions have always had direct connection to Google's mobile application development platform, Firebase, and you can trigger functions based on changes to your backend database, like a new user signing up and adding a record as well as events from analytics, authentication, or even remote configuration to the entire app.

  • IoT Backends:

    • It is a specific area of stream processing that deserves a special callout. As the internet of things continues to grow exponentially, data from these devices, whether we're talking traffic monitors, thermostats, or home smart hubs can trigger any number of Cloud Functions.

  • Unstructured data:

    • Cloud Functions can be integrated to react to detected images or categorize video clips for easy search and retrieval.
    • Cloud Functions can work with other services, like the Cloud Natural Language API, to perform sentiment analysis of text and trigger appropriate alerts and responses.


No comments:

Post a Comment