Cloud Run functions 是区域级的,这意味着运行 Cloud Run functions 函数的基础设施位于特定区域,由 Google 托管,以便在该区域内的所有可用区以冗余方式提供。
选择在其中运行 Cloud Run functions 函数的区域时,应主要考虑延迟和可用性。通常,您可以选择离您的 Cloud Run functions 函数用户最近的区域,但您还应考虑应用所使用的其他 Google Cloud 产品和服务的位置。跨多个位置使用服务可能会影响应用的延迟时间及价格。
下面列出了 Cloud Run functions 的可用区域。不同的 Cloud Run functions 版本的区域可用性也不尽相同;有关详情,请参阅表中的“支持的产品版本”列。
[[["易于理解","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-01-30。"],[[["\u003cp\u003eCloud Run functions are regional, meaning the infrastructure is located in a specific region and is managed by Google for redundant availability across all zones within that region.\u003c/p\u003e\n"],["\u003cp\u003eWhen selecting a region for Cloud Run functions, considerations should include latency, availability, and the location of other Google Cloud products and services in use.\u003c/p\u003e\n"],["\u003cp\u003eCloud Run functions offers Tier 1 and Tier 2 pricing in various regions across the globe, as determined by factors such as the geographic location.\u003c/p\u003e\n"],["\u003cp\u003eOnce a region is selected for a Cloud Run function, it cannot be changed, but new functions can be created in different regions within the same project.\u003c/p\u003e\n"],["\u003cp\u003eChanging the region of an existing function involves redeploying the function to the new region, with different steps recommended for HTTP functions and event-driven functions.\u003c/p\u003e\n"]]],[],null,["# Cloud Run functions locations (1st gen)\n=======================================\n\nCloud Run functions is *regional* , which means the infrastructure that runs a\nCloud Run function is located in a specific region and is managed by\nGoogle to be redundantly available across\n[all the zones within that region](/docs/geography-and-regions).\n\nWhen selecting a region to run your Cloud Run functions in, your primary\nconsiderations should be latency and availability. You can\ngenerally select the region closest to your Cloud Run function's users,\nbut you should also consider the location of the\n[other Google Cloud products and services](/about/locations#locations)\nthat your app uses. Using services across multiple locations can affect\nyour app's latency, as well as [pricing](/functions/pricing).\n\nThe available regions for Cloud Run functions are listed below. The different\n[versions of Cloud Run functions](/run/docs/functions/comparison)\nhave different regional availability.\n| **Note:** You can retrieve the latest set of available regions from the gcloud CLI using the [`gcloud functions regions list`](/sdk/gcloud/reference/functions/regions/list) command.\n\nTier 1 pricing\n--------------\n\nCloud Run functions is available in the following regions with\n[Tier 1 pricing](/functions/pricing):\n\nTier 2 pricing\n--------------\n\nCloud Run functions is available in the following regions with\n[Tier 2 pricing](/functions/pricing):\n\nSelect the region\n-----------------\n\nYou can select a region for your function during\n[deployment](/functions/1stgendocs/deploy). \n\n### gcloud\n\nIf you are using the Google Cloud CLI, you can specify the region by using\nthe [`--region`](/sdk/gcloud/reference/functions/deploy#--region) flag: \n\n```sh\ngcloud functions deploy --no-gen2 FUNCTION_NAME --region=REGION ...\n```\n\nWhere \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is one of the regions listed above.\n\n### Console\n\nIf you are using the Google Cloud console, you can select the region when\nyou create and deploy a function.\n\n1. In the Google Cloud console, go to the Cloud Run functions Overview\n page.\n\n [Go\n to the Cloud Run functions Overview page](https://console.cloud.google.com/functions/list)\n\n Make sure that the project for which you enabled Cloud Run functions\n is selected.\n2. Click **Create Function**.\n\n3. In the **Region** field, select a region.\n\nYou can deploy functions to different regions within a project, but once the\nregion has been selected for a function it cannot be changed.\n\nFunctions in a given region in a given project must have unique (case\nsensitive) names, but functions across regions or across projects can share\nthe same name.\n\nSetting a default region\n------------------------\n\nYou can set a default region using the Google Cloud CLI as follows: \n\n```bash\ngcloud config set functions/region REGION\n```\n\nFor example: \n\n gcloud config set functions/region europe-west1\n\nData residency\n--------------\n\nCloud Run functions provides a data residency guarantee at the function execution\nscope (Scope A Compliance---function execution), wherein a given function\nprovides for data residency for the function invocation/execution.\n\nThis compliance applies to both HTTP functions and\n[event-driven functions](/functions/1stgendocs/writing#event-driven_functions). For\nevent-driven functions, Cloud Run functions is data residency-compliant from\nthe moment the upstream product (triggering product) delivers the event to\nCloud Run functions. Hence, it's important to ensure that the upstream\nproduct (such as Cloud Storage or Pub/Sub) is itself data residency-compliant.\n\nBest practices for changing region\n----------------------------------\n\nIf you need to change a region where a function is deployed, follow the\nrecommendations below.\n\n### HTTP functions\n\nFor HTTP functions, we recommend that you first redeploy your HTTP function to\nthe destination region (it can have the same name), and then alter your original\nfunction to redirect its HTTP request to the new function. If clients of your\nHTTP function support redirects, you can simply change your original function\nto return an HTTP redirect status (`301`) along with the URL of your new\nfunction. If your clients do not handle redirects well, you can *proxy* the\nrequest from the original function to the new function by initiating a new\nrequest from the original function to the new function. The final step is to\nensure that all clients are calling the new function.\n\n### Event-driven functions\n\n[Event-driven functions](/functions/1stgendocs/writing#event-driven_functions) adopt\nan at-least-once event delivery semantic, which means\nthat under some circumstances they can receive duplicate events, and so should\nalways be implemented to be *idempotent*. If your function is already\nidempotent then you can simply redeploy the function in the new region with the\nsame event trigger, and remove the old function after you verify that the\nnew function is correctly receiving traffic. During this transition both\nfunctions will receive events.\n\nIf your function is not currently idempotent, or its idempotency does not\nextend beyond the region, then we recommend that you first implement\nidempotency before moving the function."]]