gcp-cloud-functions
यह क्या करती है
यह tool आपको Google Cloud पर छोटे प्रोग्राम (जिन्हें 'functions' कहते हैं) बनाने और भेजने देता है। ये प्रोग्राम अपने-आप चलते हैं, जब कोई घटना होती है, जैसे web request आना या कोई file add होना।
कब इस्तेमाल करें
- ✓जब आपको ऐसा प्रोग्राम चाहिए जो किसी event के जवाब में अपने-आप चले।
- ✓किसी website या app के लिए simple 'backend' बनाने के लिए।
- ✓दूसरी Google Cloud services से आने वाले data को process करने के लिए।
Skill का लिंक
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/gcp-cloud-functions/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“एक function बनाओ जो किसी link पर जाने पर 'Hello, World!' जवाब दे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
आप Python या Node.js जैसी भाषा में code लिखते हैं और कुछ खास commands से उसे Google Cloud पर भेजते हैं। ज़रूरत पड़ने पर Google Cloud आपका code चलाने का काम संभाल लेता है, बिना आपको servers manage किए।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
GCP Cloud Functions
Build and deploy event-driven serverless applications with Google Cloud Functions (Gen1 and Gen2).
When to Use
- Processing webhooks, API endpoints, or lightweight HTTP backends
- Reacting to events from Pub/Sub, Cloud Storage, Firestore, or Eventarc
- Running scheduled tasks (cron) without maintaining a server
- Building data-processing pipelines triggered by file uploads
- Prototyping microservices before committing to Cloud Run or GKE
Prerequisites
- Google Cloud SDK (
gcloud) installed and authenticated - APIs enabled: Cloud Functions, Cloud Build, Artifact Registry, Cloud Run (Gen2)
- IAM role
roles/cloudfunctions.developer(orroles/run.developerfor Gen2)
gcloud services enable cloudfunctions.googleapis.com cloudbuild.googleapis.com \
artifactregistry.googleapis.com run.googleapis.com eventarc.googleapis.com
Gen1 vs Gen2 Comparison
| Feature | Gen1 | Gen2 (recommended) |
|---|---|---|
| Runtime | Cloud Functions infra | Built on Cloud Run |
| Max timeout | 9 minutes | 60 minutes |
| Max memory | 8 GB | 32 GB |
| Concurrency | 1 request/instance | Up to 1000/instance |
| Traffic splitting | No | Yes |
| Eventarc triggers | No | Yes |
Deploy an HTTP Function (Gen2)
# Python HTTP function
gcloud functions deploy hello-http \
--gen2 --region=us-central1 --runtime=python312 \
--trigger-http --allow-unauthenticated \
--entry-point=hello_http \
--memory=256Mi --timeout=60s \
--min-instances=0 --max-instances=100 \
--set-env-vars=APP_ENV=production --source=.
# Node.js HTTP function
gcloud functions deploy hello-node \
--gen2 --region=us-central1 --runtime=nodejs20 \
--trigger-http --allow-unauthenticated \
--entry-point=helloNode --memory=256Mi --source=.
Deploy a Pub/Sub Triggered Function
gcloud pubsub topics create order-events
gcloud functions deploy process-order \
--gen2 --region=us-central1 --runtime=python312 \
--trigger-topic=order-events \
--entry-point=process_order \
--memory=512Mi --timeout=120s --retry \
--service-account=order-processor@${PROJECT_ID}.iam.gserviceaccount.com \
--source=.
Deploy a Cloud Storage Triggered Function
gcloud functions deploy process-upload \
--gen2 --region=us-central1 --runtime=python312 \
--trigger-event-filters="type=google.cloud.storage.object.v1.finalized" \
--trigger-event-filters="bucket=my-upload-bucket" \
--entry-point=process_upload \
--memory=1Gi --timeout=300s --source=.
Deploy a Scheduled Function
gcloud functions deploy daily-cleanup \
--gen2 --region=us-central1 --runtime=python312 \
--trigger-http --no-allow-unauthenticated \
--entry-point=daily_cleanup --source=.
gcloud scheduler jobs create http daily-cleanup-job \
--schedule="0 2 * * *" \
--uri="https://us-central1-${PROJECT_ID}.cloudfunctions.net/daily-cleanup" \
--http-method=POST \
--oidc-service-account-email=scheduler-sa@${PROJECT_ID}.iam.gserviceaccount.com \
--location=us-central1
Python Function Examples
# main.py
import functions_framework
import base64, json
from flask import jsonify
from google.cloud import firestore
@functions_framework.http
def hello_http(request):
"""HTTP Cloud Function."""
name = request.args.get("name", "World")
return jsonify({"message": f"Hello, {name}!", "status": "ok"}), 200
@functions_framework.cloud_event
def process_order(cloud_event):
"""Triggered by a Pub/Sub message."""
data = base64.b64decode(cloud_event.data["message"]["data"]).decode("utf-8")
order = json.loads(data)
db = firestore.Client()
db.collection("orders").document(order["id"]).set({
"status": "processing", "items": order["items"], "total": order["total"],
})
@functions_framework.cloud_event
def process_upload(cloud_event):
"""Triggered when a file is uploaded to Cloud Storage."""
data = cloud_event.data
bucket_name, file_name = data["bucket"], data["name"]
if not file_name.lower().endswith((".png", ".jpg", ".jpeg")):
return
from google.cloud import vision
client = vision.ImageAnnotatorClient()
image = vision.Image(source=vision.ImageSource(
gcs_image_uri=f"gs://{bucket_name}/{file_name}"))
labels = [l.description for l in client.label_detection(image=image).label_annotations]
print(f"Labels for {file_name}: {labels}")
# requirements.txt
functions-framework==3.*
…
अक्सर पूछे जाने वाले सवाल
'serverless' का क्या मतलब है?
इसका मतलब है कि आपको servers manage करने की चिंता नहीं करनी पड़ती। सारा infrastructure Google Cloud संभालता है।
क्या मैं कोई भी programming language इस्तेमाल कर सकता हूँ?
आप Python, Node.js, Go, Java जैसी भाषाएँ इस्तेमाल कर सकते हैं, जो service के version पर निर्भर करती हैं।
मेरा प्रोग्राम कैसे शुरू होता है?
इसे web requests (किसी link पर जाना), Google Cloud की दूसरी services के events (जैसे storage में file आना), या schedules (जैसे हर दिन किसी तय समय पर चलना) से शुरू किया जा सकता है।
जानकारी
लेखक का मूल विवरण
Deploy serverless functions on Google Cloud Functions. Configure triggers and manage deployments. Use when implementing serverless workloads on GCP.
लोकप्रियता
- GitHub स्टार
- 48k
- रैंकिंग में स्थान
- #4696
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
00-andruia-consultant
48kआपके एजेंट को AI प्रोजेक्ट शुरू करने या उन्हें बेहतर बनाने में मदद करता है। यह code का विश्लेषण करता है, tools सुझाता है और स्पेनिश भाषा में action plan बनाता है।
007
48kआपका एजेंट security audit और threat modeling करता है। यह प्रोजेक्ट को हमलों और कमजोरियों से बचाने में काम आता है।
10-andruia-skill-smith
48kआपके एजेंट को AI tools बनाने या उन्हें बेहतर करने में मदद करता है। यह तय करता है कि tools कैसे काम करेंगे, documentation लिखता है और structure की जांच करता है।
20-andruia-niche-intelligence
48kआपका एजेंट किसी खास industry का summary बनाता है। भरोसेमंद स्रोतों की मदद से यह प्रोजेक्ट का संदर्भ, नियम, इस्तेमाल के तरीके और जोखिम समझने में मदद करता है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।