done

Imagine a world where every action triggers a reaction, seamlessly and automatically. That’s the essence of Google Cloud Functions: action and reaction. This article covers what Google Cloud Functions actually is, compares the 1st gen and 2nd gen environments, walks through common use cases, and shows how to deploy a simple function.
Google Cloud Functions is a serverless compute platform that runs code in response to events, without requiring you to manage any servers. As a fully managed service, it automates tasks, powers microservices, and connects applications to other cloud products, both inside and outside the Google Cloud ecosystem. Think of it as the connective tissue that extends what your existing services can do.
The function shown above is triggered directly by an HTTP request, one of two main trigger types (the other is an event trigger). This is a 2nd gen Cloud Function, which means every library you need comes from a single import of the functions_framework. The entry point, or main function, gets registered with the runtime framework. Because it’s HTTP-triggered, it references supported HTTP methods like GET, POST, and PUT. Every Cloud Function, regardless of trigger type, must return a response.
Google Cloud Functions sits within the Functions as a Service (FaaS) category, which keeps the spotlight on your code rather than infrastructure. It supports several runtimes, including Go, Java, .NET Core, Node.js, PHP, Python, and Ruby, so you can build in the language that fits your project.
Cloud Functions has gone through two generations. The 1st gen version was triggered by HTTP requests and events from a limited set of Google Cloud Platform services. The 2nd gen version, built on Cloud Run and Eventarc, expanded that scope significantly. It now responds to a much wider range of Google Cloud services, Audit Logs, select third-party services, and HTTP requests.
The upgrade also brought a twofold increase in computing power and memory, along with roughly a thousand-fold increase in how many concurrent requests a function can handle.
Google Cloud Functions supports a wide range of use cases:
One example: pairing Cloud Functions with AI APIs to turn an uploaded image into text, translate it into multiple languages, and store the translations automatically.
The Google Cloud Functions console lets you create and deploy a function quickly. In fact, creating a function and deploying it are the same step.
You can also deploy functions from the command line. Here’s the command for deploying a 1st gen HTTP function:
gcloud functions deploy FUNCTION_NAME --source=LOCAL_PATH
--entry-point=CODE_ENTRYPOINT --trigger-http
Deploying a 2nd gen function triggered by an audit log event, such as a Cloud SQL instance failover, is just as straightforward:
gcloud functions deploy FUNCTION_NAME --gen2
--event-filters="type=google.cloud.audit.log.v1.written"
--event-filters="serviceName= serviceName=cloudsql.googleapis.com"
--event-filters="methodName= cloudsql.instances.failover"
--service-account=PROJECT_NUMBER-compute@developer.gserviceaccount.com
Google Cloud Functions is a cornerstone of modern microservice architecture, built around the cloud’s event-driven paradigm. As a serverless platform, it scales automatically, connecting actions to reactions and helping teams build responsive, event-driven systems.