Which GCP service to use - Cloud Functions

Cloud Functions - Event-driven serverless Functions

  • Google cloud compute engine - Scalable pay-as-you-go Function-as-a-service (FaaS) to run your code with zero server management.Serverless
    • Event-driven functions to handle events from google cloud.
  • Run code in response to an event
    • In many cases, events from Pub/Sub “Function triggered” to Cloud Function : Google Cloud Pub/Sub Triggers
    • e.g, Cloud Functions triggered by messages published to Pub/Sub topics in the same Cloud project as the function.
    • Pub/Sub is a globally distributed message bus that automatically scales as you need it and provides a foundation for building your own robust, global services.

How does it work

USE CASES

USE CASES OF CLOUD FUNCTIONS
  • Integration with 3rd-party services and APIs
  • Iot processing
  • Real-time data processing - Events streaming
  • Real-time file processing
  • Serverless mobile back-ends
  • Virtual assistance
  • Realtime ML
  • Serverless mobile back end
Real-time notifications workflow for Security Command Center
Serverless "mobile" back ends workflow diagram
Cloud Functions directly from Firebase to extend the application functionality without spinning up a server. Run code in response to user actions, analytics, and authentication events to keep your users engaged with event-based notifications and offload CPU- and networking-intensive tasks to Google Cloud.
Serverless IoT back ends : Cloud Functions allows you to apply custom logic to each event as it arrives.
Cloud Functions with Cloud IoT Core & other fully managed services to build back ends for IoT device telemetry data collection, real-time processing, and analysis.
Sensor : temperature reached 80℉" label
Cloud IoT Core
Pub/Sub
Cloud Functions : Trigger configuration change
Cloud IoT Core
→ Ceiling fan & turn on.
Real-time file processing : Cloud Functions enable executing code in response to changes in data
Cloud Functions can respond to events from Google Cloud services (Cloud Storage, Pub/Sub, Cloud Firestore) to process files immediately after upload and generate thumbnails from image uploads, process logs, validate content, transcode videos, validate, aggregate, and filter data in real time.
Storage
→ Labeled Function triggered to Cloud Functions & Processes uploaded image
Cloud Vision API : Detects offensive images
Cloud Functions : Blurs images using ImageMagick.
Storage.
Real-time stream processing
Use Cloud Functions to respond to pub/sub to process, transform, and enrich streaming data in transaction processing, click-stream analysis, application activity tracking, IoT device telemetry, social media analysis, and other types of applications.

Use case with Cloud Ml API

Virtual assistants and conversational experiences
Workflow from left to right. 3 boxes, labeled Slack, Messenger, and Google Home flow to Dialogflow icon, then to Cloud Functions icon, then branch to flow to AI Platform and Vision API icons at top, and Datastore icon at bottom.
Easily build artificial intelligence into your applications. Cloud Functions with Cloud Speech API and Dialogflow can extend your products and services with voice- and text-based natural conversational experiences that help users get things done. Connect with users on Google Assistant, Amazon Alexa, Facebook Messenger, and other popular platforms and devices.
Video and image analysis
Workflow moves from left to right: A blue box with right-facing white triangle (“Play”) flows to Cloud Storage / (Full-length video) icon. Flow branches up to Front end built on App Engine and down to Cloud Functions then Video Intelligence. Flow moves along lower path with arrow labeled “Video Metadata” to icon labeled Cloud Storage / (Video annotation JSON). Flow then moves up and left back to Front end build on App Engine.
Cloud Functions with Video Intelligence API & Vision API to retrieve relevant information from videos and images, enabling you to search, discover, and derive insight from your media content.
Sentiment analysis
Sentiment analysis workflow diagram: Starting on left, icon labeled Text Message has speech bubble on top: “Devoxx is such an amazing event!” Solid arrow leads right to box labeled Twilio, from which dashed arrow leads left to the Text message. From Twilio, solid arrow leads right to Cloud Functions icon, from which dashed arrow leads left to Twilio. From Cloud Functions, bi-directional arrows lead to Natural Language API / Sentiment extraction icon and to BigQuery/Trend analysis icon
Cloud Functions in combination with Cloud Natural Language API to reveal the structure and meaning of text and add powerful sentiment analysis and intent extraction capabilities to your applications

Q 41.

Your team is building an application for a global bank that will be used by millions of customers. You built a forecasting model that predicts customers' account balances 3 days in the future. Your team will use the results in a new feature that will notify users when their account balance is likely to drop below $25. How should you serve your predictions?

  • ❌ A. Create a Pub/Sub topic for each user. 2. Deploy a Cloud Function that sends a notification when your model predicts that a users account balance will drop below the $25 threshold.
  • ❌ B. Create a Pub/Sub topic for each user. 2. Deploy an application on the App Engine standard environment that sends a notification when your model predicts that a users account balance will drop below the $25 threshold.
  • ❌ C. Build a notification system on Firebase. 2. Register each user with a user ID on the Firebase Cloud Messaging server, which sends a notification when the average of all account balance predictions drops below the $25 threshold.
  • D. Build a notification system on Firebase. 2. Register each user with a user ID on the Firebase Cloud Messaging server, which sends a notification when your model predicts that a users account balance will drop below the $25 threshold.