[[["易于理解","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-05。"],[],[],null,["# Global and regional service endpoints\n\nThis page describes Spanner global and regional service endpoints and\nhow to use them.\n\nA [**service endpoint**](/apis/design/glossary#api_service_endpoint) is a base\nURL that specifies the network address of an API service. Spanner\nhas both global and regional endpoints. You can use a global or regional service\nendpoint to make requests to Spanner.\n\nUse the **global endpoint** if you don't have strict regional\nrestriction requirements. Although the data is stored within the selected region,\nthe data might be processed outside the region. The global endpoint for\nSpanner is `spanner.googleapis.com`. The default API endpoint\naccesses the global endpoint.\n\nA **regional endpoint** enforces regional restrictions. Data is stored and\nprocessed within the same region. Regional endpoints for Spanner\nensure and guarantee that the data stored and processed is restricted to the\nSpanner regional\n[instance configuration](/spanner/docs/instance-configurations) where the\ndatabase resides. Use regional endpoints if your data location must be\nrestricted and controlled to comply with regulatory requirements. You can't use\na regional endpoint to access resources belonging to a different instance\nconfiguration. You must first create an instance in the regional instance\nconfiguration before you can use the regional endpoint for that instance\nconfiguration.\n\nTo learn which regions you can use, see\n[Regions available for regional endpoints](#available-regional-endpoints). The\nunderlying Spanner storage policies don't change regardless of\nwhich endpoint you use.\n\nSecurity and compliance for regional endpoints\n----------------------------------------------\n\nThe benefit of using a Spanner regional endpoint over a global\nendpoint is that the regional endpoint provides regional isolation and\nprotection to meet security, compliance, and regulatory requirements.\n\nYou can only use regional endpoints that belong to that regional instance\nconfiguration. For example, you can't use\n`spanner.me-central2.rep.googleapis.com` to serve requests if the instance you\nare accessing belongs to the `us-central1` regional instance configuration.\nThe request will be rejected with an `InvalidRegionalRequest` error.\n\nLimitations of regional endpoints\n---------------------------------\n\nYou can't access a dual-region or multi-region instance configuration with a\nregional endpoint. You must use the global endpoint to access your dual-region\nor multi-region instance configurations. For example, if you have an instance in\nthe multi-region instance configuration `nam7`, you can't use the regional\nendpoint `spanner.us-central1.rep.googleapis.com` to send requests to your\ninstance in `nam7`.\n\nIf you have active requests that use regional endpoints on any of\nthe instance resources, [moving the instance](/spanner/docs/move-instance)\nimpacts all requests using the regional endpoint because regional enforcement\nblocks access to cross region instances. Requests using a global endpoint are\nunaffected.\n\nRegional endpoint naming convention\n-----------------------------------\n\nSpanner regional endpoint names follow the same naming convention\nas the regional instance configuration names. The regional endpoint follows the\nformat `spanner.`\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e`.rep.googleapis.com`. For example, both the regional\ninstance configuration name and regional endpoint name for Dammam are\n`me-central2`. Therefore, the regional endpoint is\n`spanner.me-central2.rep.googleapis.com`.\n\nFor more information, see\n[Available regions for regional endpoints](#available-regional-endpoints).\n\nSpecify a regional endpoint\n---------------------------\n\nYou can specify a Spanner regional endpoint using the\nGoogle Cloud CLI, REST, or RPC API requests. \n\n### gcloud\n\nTo specify a regional endpoint and override the global endpoint, run the\nfollowing command: \n\n gcloud config set api_endpoint_overrides/spanner https://spanner.\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e.rep.googleapis.com/\n\nProvide the following value:\n\n\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n: The [region](#available-regional-endpoints) for which to set a regional endpoint. For example,\n `me-central2`.\n\nFor example, to configure the regional endpoint as `me-central2`, run the\nfollowing command: \n\n gcloud config set api_endpoint_overrides/spanner https://spanner.me-central2.rep.googleapis.com/\n\nTo reconfigure a regional endpoint to the global endpoint, run: \n\n gcloud config unset api_endpoint_overrides/spanner\n\n### REST API\n\nThe default API endpoint accesses the global endpoint. To use a regional\nendpoint, configure the endpoint to the address of the regional endpoint using\nthe following pattern: \n\n https://spanner.\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e.rep.googleapis.com\n\nFor example, if you want to enforce data guarantees in the regional instance\nconfiguration Dammam (`me-central2`), use: \n\n https://spanner.me-central2.rep.googleapis.com\n\nRefer to [REST API](/spanner/docs/reference/rest) and\n[Available regions for regional endpoints](#available-regional-endpoints) for\nmore information.\n\n### RPC API\n\nThe default API endpoint accesses the global endpoint. To use a regional\nendpoint, configure the endpoint to the address of the regional endpoint using\nthe following pattern: \n\n spanner.\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e.rep.googleapis.com\n\nFor example, if you want to enforce data guarantees in the regional instance\nconfiguration Dammam (`me-central2`), use: \n\n spanner.me-central2.rep.googleapis.com\n\nRefer to [RPC API](/spanner/docs/reference/rpc) and\n[Available regions for regional endpoints](#available-regional-endpoints) for\nmore information.\n\nRegions available for regional endpoints\n----------------------------------------\n\nSpanner regional endpoints are available in the following\nregions:\n\nRestrict global API endpoint usage\n----------------------------------\n\nTo help enforce the use of regional endpoints, use the\n`constraints/gcp.restrictEndpointUsage` organization policy constraint to block\nrequests to the global API endpoint. For more information, see\n[Restricting endpoint usage](/assured-workloads/docs/restrict-endpoint-usage).\n\nWhat's next\n-----------\n\n- Learn more about Spanner [instance configurations](/spanner/docs/instance-configurations).\n\n- Learn more about [Spanner REST API](/spanner/docs/reference/rest) and\n [Global and regional endpoints](/spanner/docs/rest-endpoints).\n\n- Learn more about [Spanner RPC API](/spanner/docs/reference/rpc) and\n [Global and regional endpoints](/spanner/docs/rpc-endpoints)."]]