このガイドでは、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 のトリガー管理ガイドをよく理解してください。
[[["わかりやすい","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-08-19 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,[]]