Cloud Run Admin API(推荐):使用此 API 创建的函数(例如,使用Google Cloud 控制台、gcloud run、REST API 或 Terraform 创建的函数)只能使用 Cloud Run Admin API 进行管理。
Cloud Functions v2 API:使用此 API 创建的函数(例如,使用 gcloud functions、REST API 或 Terraform 创建的函数)可以通过 Cloud Run Admin API 以及 Cloud Functions v2 API 进行管理。使用此 API 时,您可以在部署函数时指定触发器。了解如何分离 v2 API 函数,以便仅使用 Cloud Run Admin API 对其进行管理。
Cloud Run functions(第 1 代)(以前称为 Cloud Functions [第 1 代])是函数的原始版本,具有有限的事件触发器、运行时和可配置性。了解详情。
通过将函数直接部署到 Cloud Run 上,函数将自动构建为容器并部署为 Cloud Run 服务。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["# Compare Cloud Run functions\n\nThis guide compares the latest and original Google Cloud choices for deploying\nfunctions. This page helps those who previously created functions with the\n[Cloud Functions API](/functions/docs/reference/rest) and are transitioning to the\nCloud Run Admin API. This page describes key differences in several areas,\nsuch as concepts, configuration, deployment, and triggers and retries.\n\nComparison\n----------\n\nThere are two versions of Cloud Run functions:\n\n- **Cloud Run functions** , is the latest version of functions,\n [deployed as a service on Cloud Run](/run/docs/resource-model#functions).\n They can be created in one of the following ways:\n\n - [Cloud Run Admin API](/run/docs/reference/cloud-run-admin-api-overview) (Recommended): Functions created with this API (for example, by using Google Cloud console, `gcloud run`, the REST API, or Terraform) can be managed exclusively using the Cloud Run Admin API.\n - [Cloud Functions v2 API](/functions/docs/reference/rest): Functions created with this API (for example, by using `gcloud functions`, the REST API, or Terraform) can be managed with the Cloud Run Admin API as well as the Cloud Functions v2 API. When using this API, you specify the trigger when deploying your function. Learn how to [detach](/functions/docs/managing#detach) a v2 API function so that it can be managed exclusively using the Cloud Run Admin API.\n- **Cloud Run functions (1st gen)** ,\n formerly known as Cloud Functions (1st gen), is the original version of\n functions with limited event triggers, runtimes, and configurability.\n [Learn more](/functions/1stgendocs/concepts/overview).\n\nBy deploying functions directly onto Cloud Run, your functions\nare automatically built as containers and deployed as a Cloud Run\nservice.\n\n### Concepts\n\nThe following table summarizes the conceptual differences for functions.\n\n### Configuration\n\nCloud Run builds functions into containers and deploys them as\nservices. When you deploy a function to Cloud Run, you have\ncomplete access and control over the function's behavior. For example, you can\nenable Direct VPC, configure GPUs, use volume mounts, and more.\n\nThe following table summarizes the configuration differences for functions:\n\n### Deployment\n\nSince August 2024, you can use Cloud Run to deploy and manage\nfunctions created with the Cloud Functions v2 API. As a result of this change:\n\n- Function metadata such as runtime ID and build configurations are stored in the Cloud Run service definition.\n- You can safely edit your function using the Cloud Run Admin API.\n- You can rely on the Cloud Run service definition as the source of truth for your function.\n\nHowever, note that functions created with the Cloud Run Admin API cannot be\nmodified with the Cloud Functions API.\n\nThe following table summarizes the differences in how you create, deploy, edit,\nand manage functions:\n\n### Triggers and retries\n\nThe following table compares triggers and retries for functions:\n\nDetach your function\n--------------------\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\ndetached from its existing API environment. After you detach a function, you can\nonly manage it using the\n[Cloud Run Admin API](/run/docs/reference/cloud-run-admin-api-overview). You might\nwant to do this if your workloads need to stay within the\n`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).\nSee [Manage functions](/functions/docs/managing) to learn more.\n\nWhat's next\n-----------\n\n- Try the getting started guide for [deploying a Cloud Run function](/run/docs/quickstarts/functions/deploy-functions-console)."]]