This lab walks you through GCP Cloud Functions
We will learn the difference between Cloud Functions, App Engine, and Cloud Run.
You will be creating a Simple Cloud Function listing names of all the VM Instances in the Project.
Region: us-central1
Duration: 45 minutes
Cloud Function lets you deploy snippets of code (functions) written in a limited set of programming languages, to natively handle HTTP requests or events from many GCP sources.
Cloud Functions lets you establish triggers on a wide variety of events that can come from a variety of Cloud and Firebase products.
Cloud Functions are limited in respect to the libraries, languages, and runtimes supported.
Cloud Functions server instances handle requests in a serial manner, which is not configurable whereas Cloud Run instances handle requests in a parallel manner, and the level of parallelism is configurable.
Cloud Functions allow you to choose from a set of programming languages and runtimes that is not configurable without requiring that you do anything other than deploying your code whereas Cloud Run allows you to choose any kind of backend configuration, but it requires that you supply a docker configuration that creates the runtime environment (which is more work).
App Engine is more suitable for applications, which have numerous functionalities inter-related even unrelated with eath other e.g. microservices, while cloud functions are more events based functions and perform some single-purpose action.
It is easy to replicate Cloud Functions on Google App Engine, but replicating an App Engine application on Cloud Functions would be complicated.
Login into GCP Console.
Creating a Cloud Function to list all the VM instances in the Project.
Once you start the lab, 1 VM Instance will be provisioned named whizlabs-cloud-function.
Trigger the function through HTTP Request to print the list of VM instances in the Project.