请注意,VERSION-dot-SERVICE-dot-PROJECT_ID 的总长度(其中 VERSION 是版本名称,SERVICE
是服务名称,PROJECT_ID 是项目 ID)不得超过 63 个字符,且首尾不能使用连字符。如果组合长度超过 63 个字符,您可能会看到错误 DNS address could not be
found.
将客户端请求配置为通过添加目标主机名的 DNS 条目来使用 private.googleapis.com IP 范围。按照 DNS 配置添加 DNS 主机名,但请务必将专用区域配置为针对 appspot.com,而不是 googleapis.com。此外,请确保将流量定向到目标应用的 appspot.com 地址,而不是自定义网域。您只能使用此 appspot.com 网域在 private.googleapis.com IP 范围访问您的应用。
将客户端应用配置为通过无服务器 VPC 访问通道连接器发送all-traffic,而不是将请求配置为使用 private.googleapis.com IP 范围。
不同项目中的服务之间的通信
如果项目中运行的应用属于共享 VPC 网络(配置为调用在共享 VPC 网络的宿主项目中运行的应用),则您可以在 Google 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"]],["最后更新时间 (UTC):2025-08-20。"],[[["\u003cp\u003eRegion IDs are assigned by Google during app creation and are included in App Engine URLs for apps created after February 2020, and these IDs do not correspond to countries or provinces.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine services can communicate via targeted HTTP requests, using URLs that include version, service, project ID, and region ID, however, there is a combined length restriction of 63 characters for the version, service, and project ID.\u003c/p\u003e\n"],["\u003cp\u003eServices within the same project can communicate privately by configuring ingress controls to allow internal traffic only, routing traffic over a Serverless VPC Access connector, and setting up DNS configurations or sending all-traffic.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine services can also use Pub/Sub for asynchronous messaging and share data across databases or other external applications.\u003c/p\u003e\n"],["\u003cp\u003eCertain URL paths such as paths ending with /eventlog and paths starting with /_ah/ are reserved and cannot be used.\u003c/p\u003e\n"]]],[],null,["# Communicating between your services\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n### Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/standard/python/how-requests-are-routed#region-id). \nOK\n\nYou can use various methods to communicate between your App Engine\nservices or with other services, including Google Cloud services and\nexternal applications.\n\nThe simplest approach for communicating with your App Engine service is\nto send targeted HTTP requests, where the URL includes the name or ID of a\nresource. For example, you can include the ID of a service or version that you\nwant to target, in addition to the corresponding Google Cloud project ID: \n\n\n `https://`\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e`-dot-`\u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e`-dot-`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`\n\nNote that the combined length of\n\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e`-dot-`\u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e`-dot-`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003e\u003c/a\u003e\u003c/var\u003e, where\n`VERSION` is the name of your version, `SERVICE\n` is the name of your service, and `PROJECT_ID` is your\nproject ID, cannot be longer than 63 characters and cannot start or end with\na hyphen. If the combined length is\nlonger than 63 characters, you might see Error `DNS address could not be\nfound. `\n\nLearn more about requests in App Engine:\n\n- [How requests are\n handled](/appengine/docs/standard/how-requests-are-handled): Learn how your application receives requests and sends responses.\n- [How requests are routed](/appengine/docs/standard/how-requests-are-routed): Learn how to target your services, including how to define HTTPS URLs.\n- Learn how to authorize the requests between your services and other Google Cloud services:\n - [Provide credentials for Application Default Credentials](/docs/authentication/provide-credentials-adc)\n - [Using user-managed service accounts](/appengine/docs/standard/user-managed-service-accounts)\n\nYour App Engine services can also communicate using\n[Pub/Sub](/pubsub/docs), which provides reliable asynchronous\nmany-to-many messaging between processes, including App Engine. These\nprocesses can be individual instances of your application, services, or even\nexternal applications.\n\nTo share data across databases and your App Engine app or some other\nexternal application, see\n[Understanding Data and File Storage](/appengine/docs/standard/storage-options).\n\nIf you use the legacy bundled services, you can also pass requests between services and\nfrom services to external endpoints using the\n[URL Fetch](/appengine/docs/legacy/standard/python/issue-requests) API.\n\nAdditionally, services in the standard environment that reside within the same\nGoogle Cloud project can also use one of the App Engine APIs for the\nfollowing tasks:\n\n- Share a single [memcache](/appengine/docs/legacy/standard/python/memcache) instance.\n- Collaborate by assigning work between services through [Task Queues](/appengine/docs/legacy/standard/python/taskqueue).\n\nPrivate Communication\n---------------------\n\n### Communication between services in the same project\n\nYou can allow an App Engine standard service to communicate with\nanother App Engine service in the same project without having to expose\nthe destination service to the public internet.\n\nTo allow communication between services in the same project:\n\n1. Configure ingress controls by adjusting the destination service's\n [ingress settings](/appengine/docs/standard/ingress-settings)\n to allow \"internal\" traffic only.\n\n The \"internal\" setting allows requests from the project's VPC\n networks only. This includes App Engine resources from a client app on\n the same network when egress traffic is routed over a connector.\n All other traffic from the internet or other Google Cloud projects,\n including other App Engine services, is blocked.\n | **Note:** The \"internal\" traffic setting blocks all traffic from additional Google Cloud services that do not use the VPC network, such as URLFetch, Cloud Tasks, and Pub/Sub, even within the same project.\n2. Route the traffic over a [Serverless VPC Access connector](/vpc/docs/configure-serverless-vpc-access#appengine):\n\n 1. For each App Engine version sending private traffic to other app\n endpoints, attach the version to a Serverless VPC Access connector\n belonging to one of the Google Cloud project's own networks, not a\n Shared VPC network.\n\n 2. Ensure Private Google Access is enabled for the subnet used by the\n Serverless VPC Access connector.\n\n 3. Configure one of the following:\n\n - Configure client requests to use the `private.googleapis.com` IP range\n by adding a DNS entry for the destination hostname. Follow\n [DNS configuration](/vpc/docs/configure-private-google-access#config-domain)\n to add the DNS hostname, but be sure to configure the private zone\n to be for `appspot.com` rather than `googleapis.com`. Also ensure that\n traffic is directed to the destination app's `appspot.com` address,\n not a custom domain. Your app can only be reached on the\n `private.googleapis.com` IP range using this `appspot.com` domain.\n\n - Configure the client app to\n [send](/appengine/docs/standard/connecting-vpc#manage)\n `all-traffic` through the Serverless VPC Access connector,\n instead of configuring requests to use the `private.googleapis.com` IP\n range.\n\n### Communication between services in different projects\n\nYou can have private access between Google Cloud projects when apps running\nin projects belong to a Shared VPC network that is\nconfigured to invoke an app running in the Shared VPC network's host project.\n\nTo use this pattern, follow the previous steps for\n[communicating between services in the same project](#between-services).\n\nIn the standard environment, attach each client version to a\nServerless VPC Access connector on the Shared VPC network.\n\n\nOther methods of communication between projects using internal access are not\npossible in App Engine.\n\nReserved URL paths\n------------------\n\nIt is not possible to use the following URL paths:\n\n- Paths ending with `/eventlog`\n- Paths starting with `/_ah/`\n- Some paths ending with `z`"]]