Skip to content
gcp-functions logo

GCP Cloud Functions

gcp-functions

GCP Cloud Functions 배포/관리

SKILL.md

Full skill instructions

GCP Cloud Functions

Cloud Functions를 배포하고 관리합니다.

사용법

/​gcp-functions                     # 함수 목록 조회
/​gcp-functions deploy my-func      # 함수 배포
/​gcp-functions logs my-func        # 로그 조회
/​gcp-functions delete my-func      # 함수 삭제

Workflow

0. API 활성화 (최초 1회)

gcloud services enable cloudfunctions.googleapis.com --project=$PROJECT_ID
gcloud services enable cloudbuild.googleapis.com --project=$PROJECT_ID

1. 함수 목록 조회

PROJECT_ID=$(gcloud config get-value project)
REGION=asia-northeast3

# Gen 2 (권장)
gcloud functions list --project=$PROJECT_ID --gen2 \
  --format="table(name.basename(),state,runtime,updateTime.date())"

# Gen 1
gcloud functions list --project=$PROJECT_ID \
  --format="table(name,status,runtime,updateTime.date())"

2. HTTP 함수 배포 (Gen 2)

# 현재 디렉토리에서 배포
gcloud functions deploy FUNCTION_NAME \
  --gen2 \
  --runtime=python311 \
  --region=$REGION \
  --source=. \
  --entry-point=main \
  --trigger-http \
  --allow-unauthenticated

# 환경변수 설정
gcloud functions deploy FUNCTION_NAME \
  --gen2 \
  --runtime=nodejs20 \
  --region=$REGION \
  --source=. \
  --entry-point=handler \
  --trigger-http \
  --set-env-vars="API_KEY=xxx,DEBUG=true"

3. 이벤트 트리거 함수

# Pub/​Sub 트리거
gcloud functions deploy FUNCTION_NAME \
  --gen2 \
  --runtime=python311 \
  --region=$REGION \
  --source=. \
  --entry-point=process_message \
  --trigger-topic=TOPIC_NAME

# Cloud Storage 트리거
gcloud functions deploy FUNCTION_NAME \
  --gen2 \
  --runtime=python311 \
  --region=$REGION \
  --source=. \
  --entry-point=process_file \
  --trigger-event-filters="type=google.cloud.storage.object.v1.finalized" \
  --trigger-event-filters="bucket=BUCKET_NAME"

4. 함수 설정 업데이트

gcloud functions deploy FUNCTION_NAME \
  --gen2 \
  --region=$REGION \
  --memory=256MB \
  --timeout=60s \
  --min-instances=0 \
  --max-instances=100

5. 로그 조회

gcloud functions logs read FUNCTION_NAME \
  --region=$REGION \
  --gen2 \
  --limit=50

6. 함수 호출 (테스트)

# HTTP 함수
curl $(gcloud functions describe FUNCTION_NAME --gen2 --region=$REGION --format='value(url)')

# 데이터와 함께
curl -X POST \
  -H "Content-Type: application/​json" \
  -d '{"name": "test"}' \
  $(gcloud functions describe FUNCTION_NAME --gen2 --region=$REGION --format='value(url)')

7. 함수 삭제

gcloud functions delete FUNCTION_NAME --region=$REGION --gen2

런타임 지원

런타임버전
Pythonpython311, python312
Node.jsnodejs18, nodejs20
Gogo121, go122
Javajava17, java21
Rubyruby32

출력 형식

## Cloud Functions 목록

| 함수 이름 | 상태 | 런타임 | 트리거 | 업데이트 |
|-----------|------|--------|--------|----------|
| process-order | ACTIVE | python311 | HTTP | 2024-01-15 |
| send-email | ACTIVE | nodejs20 | Pub/​Sub | 2024-02-01 |

---

### process-order 상세

| 항목 | 값 |
|------|-----|
| URL | https://xxx.cloudfunctions.net/​process-order |
| 리전 | asia-northeast3 |
| 메모리 | 256MB |
| 타임아웃 | 60s |
| 최대 인스턴스 | 100 |

샘플 코드

Python (main.py)

import functions_framework

@functions_framework.http
def main(request):
    name = request.args.get('name', 'World')
    return f'Hello, {name}!'

Node.js (index.js)

exports.handler = (req, res) => {
  const name = req.query.name || 'World';
  res.send(`Hello, ${name}!`);
};

Gen 1 vs Gen 2

기능Gen 1Gen 2
기반Cloud FunctionsCloud Run
최대 타임아웃9분60분
최대 메모리8GB32GB
동시성11000
가격조금 저렴유연

비용 (Gen 2)

리소스무료 티어초과 시
호출200만/월$0.40/​100만
컴퓨팅400,000 GB-초/월$0.0000025/​100ms
네트워크5GB/월$0.12/​GB

주의사항

  • Gen 2 권장 (새 프로젝트)
  • 콜드 스타트 시간 고려
  • 로컬 테스트: functions-framework 사용

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View