Deploy serverless functions on Google Cloud Platform with triggers, IAM roles, environment variables, and monitoring. Use for event-driven computing on GCP.
Google Cloud Functions enables event-driven serverless computing on Google Cloud Platform. Build functions with automatic scaling, integrated security, and seamless integration with Google Cloud services for rapid development.
Minimal working example:
# Install Google Cloud SDK
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
# Initialize and authenticate
gcloud init
gcloud auth application-default login
# Set project
gcloud config set project MY_PROJECT_ID
# Create service account
gcloud iam service-accounts create cloud-function-sa \
--display-name "Cloud Function Service Account"
# Grant permissions
gcloud projects add-iam-policy-binding MY_PROJECT_ID \
--member="serviceAccount:cloud-function-sa@MY_PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/cloudfunctions.invoker"
# Deploy HTTP function
gcloud functions deploy my-http-function \
--gen2 \
--runtime nodejs18 \
--region us-central1 \
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents | |---|---| | Cloud Function Creation with gcloud CLI | Cloud Function Creation with gcloud CLI | | Cloud Functions Implementation (Node.js) | Cloud Functions Implementation (Node.js) | | Terraform Cloud Functions Configuration | Terraform Cloud Functions Configuration |
Copy a source-pinned command for your client. You run it yourself.
Destination: .claude/skills/gcp-cloud-functions · pinned to the source commit
git clone https://github.com/aj-geddes/useful-ai-prompts.git
cd useful-ai-prompts
git checkout 3f5182cfd739fc113f4af5244a1cf342ad7f7911
mkdir -p ".claude/skills/gcp-cloud-functions"
cp -r "skills/gcp-cloud-functions" ".claude/skills/gcp-cloud-functions"Review the source before running. This copies files into your project; it is not a one-click install and does not verify runtime safety.
Scanner static-checks@0.1.0 · commit 3f5182cfd739. Static checks cannot prove runtime safety – review the source and the exact diff before installing. How checks work.
Piping a downloaded script directly into a shell runs unreviewed remote code.
Evidence: curl https://sdk.cloud.google.com | bash· fingerprint 404be42a407cad8c
Fetches remote content at runtime, which can change after review.
Evidence: curl· fingerprint 427e4b79b1f0fc90