|
|
Cloud Functions
Author: Venkata Sudhakar
Google Cloud Functions is a serverless execution environment for building and connecting cloud services. It lets you run single-purpose functions in response to events without managing servers or runtime environments. Key Features: 1. Event-driven - Triggered by HTTP, Pub/Sub, Cloud Storage, Firestore, and more. 2. Serverless - Zero server management; scales from zero automatically. 3. Multiple runtimes - Node.js, Python, Go, Java, .NET, Ruby, PHP. 4. Pay per use - Billed per invocation and compute time with a generous free tier. 5. 2nd gen - Built on Cloud Run, supports longer timeouts and concurrency. The below example shows an HTTP-triggered Cloud Function in Python.
Deploy and invoke the function,
It gives the following output,
{"message": "Hello, GCP!", "status": "success"}
Trigger Types: HTTP triggers - Invoke via REST calls. Best for webhooks and APIs. Event triggers - React to Cloud Storage uploads, Pub/Sub messages, Firestore changes, and other GCP events automatically.
|
|