이 가이드에서는 gcloud functions 명령어로 생성된 함수를 관리하고 분리하는 방법을 보여줍니다. gcloud run 명령어로 만든 함수를 관리하는 방법을 알아보려면 Cloud Run 서비스 관리를 참조하세요.
Cloud Functions v2 API(예: gcloud functions, REST API 또는 Terraform 사용)를 사용하여 만든 함수를 Cloud Run Admin API 및 Cloud Functions v2 API로 관리할 수 있습니다. 예를 들어 gcloud functions 또는 gcloud run 명령어를 사용하여 기존 함수를 업데이트할 수 있습니다.
gcloud run deploy FUNCTION_NAME \
--source= . \
--function=ENTRYPOINT
--base-image=google-22-full/nodejs22
분리
gcloud functions detach 명령어를 사용하면 Cloud Functions v2 함수를 기존 API 환경에서 분리할 수 있습니다. 함수를 분리한 후에는 Cloud Run Admin API를 통해서만 함수를 관리할 수 있습니다. 워크로드가 Assured Workloads의 run.googleapis.com API 경계 내에 있어야 하거나 워크로드에서 Cloud Run SKU를 사용해야 하는 경우 이 작업을 수행할 수 있습니다.
분리를 위한 함수 준비
함수를 분리하려고 할 때 다음 사항을 고려하세요.
분리 작업을 되돌릴 수 없습니다.
Cloud Run Functions(1세대)에는 분리 작업을 적용할 수 없습니다.
Google Cloud 콘솔, Google Cloud CLI, Terraform을 사용하여 Cloud Run에서 함수를 배포하는 방법을 알아봅니다.
HTTP 함수는 할당된 URL을 유지합니다.
이벤트 기반 함수에 연결된 트리거는 유지됩니다.
run.googleapis.com API를 통해 트리거를 직접 관리할 수 없습니다.
Eventarc 또는 Pub/Sub의 트리거 관리 가이드를 숙지하세요.
분리 작업 중에 Cloud Run Functions는 실패 시 재시도 안함으로 구성된 함수에 연결된 트리거를 수정하여 기본 Pub/Sub 주제에서 전송을 최대 5회까지 시도하도록 합니다. 분리 작업이 완료되면 데드 레터 큐 주제에 전송되지 않은 메시지가 저장되므로 데드 레터 큐에 대한 새 구독을 만들어 이러한 메시지를 검색할 수 있습니다.
함수가 성공적으로 분리되면 새 Cloud Run 버전이 생성됩니다. 이 버전부터 함수에 Cloud Run SKU를 통해 요금이 청구됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[[["\u003cp\u003eCloud Functions v2 API functions can be managed using either the Cloud Functions v2 API or the Cloud Run Admin API, allowing for flexibility in deployment and updates via \u003ccode\u003egcloud functions\u003c/code\u003e or \u003ccode\u003egcloud run\u003c/code\u003e commands.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud beta functions detach\u003c/code\u003e command enables the detachment of a Cloud Functions v2 function from its original API environment, transitioning its management exclusively to the Cloud Run Admin API.\u003c/p\u003e\n"],["\u003cp\u003eDetaching a function is irreversible and not applicable to Cloud Run (1st gen) functions, but HTTP functions retain their URLs and event-driven functions retain triggers.\u003c/p\u003e\n"],["\u003cp\u003eDetaching a function to the Cloud Run Admin API changes the billing to the Cloud Run SKU, and modifies the retry settings for event-driven functions to ensure a maximum of five delivery attempts with the use of a dead letter queue for undelivered messages.\u003c/p\u003e\n"],["\u003cp\u003eFollowing a successful detach operation, a new Cloud Run revision of the function is created, marking the point from which the function will be managed and billed through the Cloud Run framework.\u003c/p\u003e\n"]]],[],null,["# Manage functions\n================\n\nThis guide shows you how to manage and detach a function that was created with\nthe `gcloud functions` command. To learn how to manage a function that was\ncreated with the `gcloud run` command, see [Manage Cloud Run services](/run/docs/managing/services).\n| **Note:** If you created a Cloud Run function using `gcloud run` commands or the Cloud Run Admin API, you can't manage that function with `gcloud functions` commands or the Cloud Functions v2 API.\n\nFunctions created using the [Cloud Functions v2 API](/functions/docs/apis)\n(for example, by using `gcloud functions`, the REST API, or Terraform) can be\nmanaged with the [Cloud Run Admin API](/run/docs/reference/cloud-run-admin-api-overview)\nas well as the Cloud Functions v2 API. For example, you can update an\nexisting function using either `gcloud functions` or `gcloud run` commands: \n\n### gcloud functions\n\n gcloud functions deploy \u003cvar translate=\"no\"\u003eFUNCTION_NAME\u003c/var\u003e \\\n --runtime=nodejs22 \\\n --source= . \\\n --entry-point=\u003cvar translate=\"no\"\u003eENTRYPOINT\u003c/var\u003e\n --trigger-http\n\n### gcloud run\n\n gcloud run deploy \u003cvar translate=\"no\"\u003eFUNCTION_NAME\u003c/var\u003e \\\n --source= . \\\n --function=\u003cvar translate=\"no\"\u003eENTRYPOINT\u003c/var\u003e\n --base-image=google-22-full/nodejs22\n\nDetach\n------\n\nThe [`gcloud functions detach`](/sdk/gcloud/reference/functions/detach)\ncommand lets you detach a Cloud Functions v2 function from its existing\nAPI environment. After you detach a function, you can only manage it using the\nCloud Run Admin API. You might want to do this if your workloads need to stay\nwithin the `run.googleapis.com` API boundary for\n[Assured Workloads](/assured-workloads/docs/overview), or to ensure\nthat your workloads use the [Cloud Run SKU](/skus/sku-groups/cloud-run).\n\n### Prepare your function for detach\n\nWhen preparing to detach your function, consider the following:\n\n- The detach operation is not reversible.\n- The detach operation cannot be applied to Cloud Run functions (1st gen).\n- Familiarize yourself with how to [deploy functions in Cloud Run](/run/docs/deploy-functions) using the Google Cloud console, Google Cloud CLI, and Terraform.\n- HTTP functions will retain their assigned URLs.\n- Triggers attached to event-driven functions will be retained.\n- Triggers cannot be managed through the `run.googleapis.com` API directly. Be sure to familiarize yourself with the trigger management guides for [Eventarc](/eventarc/docs) or [Pub/Sub](/pubsub/docs/overview).\n- Disabling [retry on failure](/functions/docs/bestpractices/retries#event_driven_functions_created_with_v2_api) is not a supported feature on Cloud Run.\n - During the detach operation, Cloud Run functions modifies the triggers attached to functions configured with [no retry on failure](/functions/docs/bestpractices/retries#event_driven_functions_created_with_v2_api), to ensure that the underlying Pub/Sub topic makes a maximum of five delivery attempts. When the detach operation is completed, a [dead letter queue](/pubsub/docs/handling-failures#how_dead_letter_topics_work) topic stores the undelivered messages, which you can retrieve by creating a new subscription to the dead letter queue.\n- When a function is successfully detached, a new Cloud Run revision is created. Starting from that revision onwards, the function will be billed using the [Cloud Run SKU](/skus/sku-groups/cloud-run).\n\n### Detach your function\n\nYou can detach your function using the following command: \n\n gcloud functions detach \u003cvar translate=\"no\"\u003eFUNCTION_NAME\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003eFUNCTION_NAME\u003c/var\u003e with the name of your function."]]