Original study notes for cloud certification exams — Google Cloud first, more clouds in build.

Cloud Functions Study Notes

Cloud Functions is a serverless execution environment for running small, single-purpose pieces of code in response to events or HTTP requests, without provisioning servers. Google manages scaling and infrastructure, and you pay based on invocations and compute time. Under the current generation, functions are built and run using Cloud Run infrastructure under the hood while keeping the functions deployment experience.

Exam tip: A short reaction to a Storage, Pub/Sub, or Firestore event with no server to run is the textbook Cloud Functions answer.

Key facts

What the exam expects you to know

Cloud Functions vs Cloud Run: when to use which

Choose Cloud Functions when the work is a small piece of code reacting to an event, such as processing a file on upload or transforming a Pub/Sub message, and you do not want to build a container. Choose Cloud Run when you need a full service, custom system libraries, a specific container image, or more complex request handling. The criteria are unit of work and control: functions optimize for speed of development on events, while Cloud Run optimizes for portable containers and service behavior. See also the Cloud Run notes.

Useful gcloud commands

gcloud functions deploy my-function --runtime=python312 --trigger-http --allow-unauthenticated
gcloud functions list
gcloud functions logs read my-function
gcloud functions call my-function

Common exam traps

Frequently asked questions

What triggers can start a Cloud Function?

A function can be invoked by an HTTP request, by messages published to a Pub/Sub topic, by changes to a Cloud Storage bucket such as a new object upload, and by events from other services including Firestore and the eventing system based on Eventarc. You choose one trigger type when you deploy the function.

Why must functions be idempotent?

Many event sources deliver messages at least once, and the platform may retry a failed invocation, so the same event can be processed two or more times. An idempotent function produces the same safe result on repetition, for example by checking whether an output file or record already exists before creating it again.

How do I give a function access to a private database?

Attach a Serverless VPC Access connector to the function so its traffic can enter your VPC, place the database on a private address reachable from that network, and connect using the database's private IP or its proxy integration. Also grant the function's service account only the IAM roles and secrets it actually needs.

Study aid disclaimer: Cloud Cert Notes is an independent educational study aid. It is not affiliated with, endorsed by, or sponsored by Google, Microsoft, Amazon, Oracle, or Alibaba. Google Cloud, Associate Cloud Engineer, and Cloud Digital Leader are trademarks of Google LLC; all other certification names and product names are trademarks of their respective owners. Always confirm service details against the official provider documentation before sitting an exam.