Cloud Run 可省去管理伺服器、設定軟體、更新架構以及修補作業系統的工作。軟體與基礎架構則由 Google 全代管,因此,您只需新增程式碼即可。此外,系統會自動佈建資源,以回應要求或事件。這表示 Cloud Run 服務會自動從一天幾次叫用擴展到數百萬次叫用,而您無需處理任何工作。如要進一步控管調整資源配置的行為,可以選擇使用手動調整資源配置。
將函式、原始碼或容器映像檔部署到 Cloud Run 後,您就能享有 容器執行階段合約中所述的所有優點。
Cloud Run 函式提供邏輯連接層,可讓您以撰寫程式碼的方式連結及擴充雲端服務。當您將檔案上傳至 Cloud Storage、記錄檔有所變更或收到來自 Pub/Sub 主題的訊息時,都能獲得相關資訊並進行回應。Cloud Run 函式擴大現有的雲端服務,可讓您透過任意程式設計邏輯處理與日俱增的使用案例。Cloud Run 函式可存取 Google 服務帳戶憑證,因此能順利地通過大多數 Google Cloud 服務的驗證,包括 Cloud Vision 以及許多其他服務。此外,Cloud Run 函式還受許多 Cloud 用戶端程式庫的支援,這些程式庫可進一步簡化這類整合作業。
[[["容易理解","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-04 (世界標準時間)。"],[],[],null,["# When should I deploy a function to Cloud Run?\n\n| **Note:** Cloud Functions has been renamed to Cloud Run functions. For more information, see the [Cloud Run functions blog post](https://cloud.google.com/blog/products/serverless/google-cloud-functions-is-now-cloud-run-functions).\n\nCloud Run removes the work of managing servers, configuring\nsoftware, updating frameworks, and patching operating systems. The software and\ninfrastructure are fully managed by Google so that you just add code.\nFurthermore, provisioning of resources happens automatically in response to\nrequests or events.\nThis means that a Cloud Run service automatically scales out from a few\ninvocations a day to many millions of invocations without any work from you.\nYou can optionally use [manual scaling](/run/docs/configuring/services/manual-scaling)\nif you need more control over your scaling behavior.\n\nWhen you deploy a function, source code or a container image to\nCloud Run, you receive all of the benefits described in the\n[Container runtime contract](/run/docs/container-contract).\n\nUse cases for deploying functions\n---------------------------------\n\nYou can directly deploy a function bound to events in order to implement\nasynchronous workloads (such as lightweight [ETL](/learn/what-is-etl)) or cloud\nautomations (such as triggering application builds).\nIn addition, the automatic provisioning of an HTTPS endpoint makes functions a\nperfect candidate for webhooks.\n\nSee the following table for additional common use cases for deploying a function\nto Cloud Run:\n\nConnect and extend cloud services\n---------------------------------\n\nCloud Run functions provides a connective layer of logic that lets you write\ncode to connect and extend cloud services. Listen and respond to a file upload\nto Cloud Storage, a log change, or an incoming message on a Pub/Sub\ntopic. Cloud Run functions augments existing cloud services and lets you\naddress an increasing number of use cases with arbitrary programming logic.\nCloud Run functions have access to the Google Service Account credential and\nare thus seamlessly authenticated with the majority of Google Cloud services,\nincluding Cloud Vision, as well as many others. In addition,\nCloud Run functions are supported by numerous\n[Cloud Client Libraries](/apis/docs/cloud-client-libraries), which\nfurther simplify these integrations.\n\nWhat's next\n-----------\n\n- Try the [getting started guide for deploying a function](/run/docs/quickstarts/functions/deploy-functions-console).\n- If you have existing functions and need to use the `gcloud functions deploy` command, the Cloud Functions v2 API, or the `google_cloudfunctions2_function` Terraform configuration for backward compatibility, you can [deploy functions with the `gcloud functions` command](/functions/docs/deploy)."]]