請注意,VERSION-dot-SERVICE-dot-PROJECT_ID 的總長度不得超過 63 個字元,且開頭或結尾不得使用連字號。其中 VERSION 是版本名稱、SERVICE
是服務名稱,而 PROJECT_ID 是專案 ID。如果合併長度超過 63 個半形字元,您可能會看到錯誤 DNS address could not be
found.
針對每個將私人流量傳送至其他應用程式端點的 App Engine 版本,請將該版本附加至屬於專案自有網路的 Serverless VPC Access 連接器,而非共用虛擬私有雲網路。 Google Cloud
確保無伺服器 VPC 存取連接器使用的子網路已啟用私人 Google 存取權。
設定下列任一項目:
為目的地主機名稱新增 DNS 項目,設定用戶端要求使用 private.googleapis.com IP 範圍。請按照DNS 設定新增 DNS 主機名稱,但請務必將私人區域設定為 appspot.com 而非 googleapis.com。此外,請確認流量會導向目的地應用程式的 appspot.com 位址,而非自訂網域。您的應用程式只能透過 private.googleapis.com IP 範圍使用這個 appspot.com 網域。
請將用戶端應用程式設為透過無伺服器虛擬私有雲存取連接器傳送all-traffic,而非將要求設為使用 private.googleapis.com IP 範圍。
不同專案中的服務之間通訊
如果在專案中執行的應用程式屬於共用虛擬私有雲網路,且該網路已設定為在共用虛擬私有雲網路的主機專案中叫用應用程式,您就可以在 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"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\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`"]]