본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)48k · #4696

gcp-cloud-functions

하는 일

이 도구를 사용하면 '함수'라고 부르는 작은 프로그램을 만들어 Google Cloud에 올릴 수 있습니다. 이 프로그램은 웹 요청을 받거나 파일이 추가되는 등 특정 일이 일어나면 자동으로 실행됩니다.

사용하는 경우

  • ✓이벤트에 반응해 프로그램이 자동으로 실행되어야 할 때.
  • ✓웹사이트나 앱을 위한 간단한 '백엔드'를 만들 때.
  • ✓다른 Google Cloud 서비스에서 오는 데이터를 처리할 때.

스킬 링크

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에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/gcp-cloud-functions/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“누군가 링크를 방문하면 'Hello, World!'라고 응답하는 함수를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

Python이나 Node.js 같은 언어로 코드를 작성하고, 특정 명령으로 Google Cloud에 올립니다. Google Cloud는 필요할 때 코드를 실행하며, 서버 관리는 사용자가 하지 않아도 됩니다.

기술 내용 (원본 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 (or roles/run.developer for 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.*

…
자주 묻는 질문

「서버리스」란 무엇인가요?

서버를 관리할 걱정이 없다는 뜻입니다. Google Cloud가 기반 인프라를 모두 처리합니다.

어떤 프로그래밍 언어든 쓸 수 있나요?

Python, Node.js, Go, Java 등을 쓸 수 있으며, 서비스 버전에 따라 다릅니다.

프로그램은 어떻게 실행되나요?

웹 요청(링크 방문), 다른 Google Cloud 서비스의 이벤트(스토리지에 파일 추가 등), 또는 일정(매일 특정 시간에 실행 등)으로 실행될 수 있습니다.

상세 정보

작성자의 원본 설명

Deploy serverless functions on Google Cloud Functions. Configure triggers and manage deployments. Use when implementing serverless workloads on GCP.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4696
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬