[[["易于理解","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-21。"],[[["\u003cp\u003eRegion ID is a code assigned by Google based on the selected region during app creation, and it's included in App Engine URLs for apps created after February 2020.\u003c/p\u003e\n"],["\u003cp\u003eIngress settings determine network access to your App Engine app, with options including "Internal," "Internal and Cloud Load Balancing," and "All" to control traffic sources.\u003c/p\u003e\n"],["\u003cp\u003eThe "Internal" ingress setting is the most restrictive, allowing only requests from resources within the project's VPC networks, while "All" is the least restrictive, permitting all internet traffic.\u003c/p\u003e\n"],["\u003cp\u003eEgress settings, available for most runtimes except PHP, define how outbound requests from your App Engine service are routed, with options to direct traffic to your VPC network or directly to the internet.\u003c/p\u003e\n"],["\u003cp\u003eYou can view and edit ingress settings via the Google Cloud Console or the gcloud command-line interface, and you can update the egress setting in the app.yaml file.\u003c/p\u003e\n"]]],[],null,["# Ingress settings\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\nThis section describes how to use ingress settings to restrict network access to\nyour App Engine app. At a network level, by default, any resource on\nthe internet is able to reach your App Engine app on its\n[appspot URL](/appengine/docs/standard/how-requests-are-routed)\nor at a [custom domain](/appengine/docs/standard/mapping-custom-domains)\nset up in App Engine. For example, the `appspot.com` URL can have the\nfollowing format:\n\u003cvar translate=\"no\"\u003eSERVICE_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r.appspot.com`.\n\nYou can change this default setting by specifying a\ndifferent setting for ingress. All ingress paths, including the default\n`appspot.com` URL, are subject to your ingress setting. Ingress is set at the\nservice level.\n\nAvailable ingress settings\n--------------------------\n\nThe following settings are available:\n\n### Accessing internal services\n\nThe following considerations apply:\n\n- For requests from a Shared VPC, traffic is only considered internal if the\n App Engine app is deployed in the Shared VPC host project. If the\n App Engine app is deployed in a Shared VPC service project, only traffic\n from networks owned by the app's own project is internal. All other traffic,\n including traffic from other Shared VPCs, is external.\n\n- When accessing internal services, call them as you would normally do by using\n their public URLs, either the default `appspot.com` URL or a\n [custom domain](/run/docs/mapping-custom-domains) set up in App Engine.\n\n- For requests from Compute Engine VM instances or other resources running\n inside a\n\n [VPC network](/appengine/docs/standard/connecting-vpc)\n in the same project, no further setup is required.\n\n- Requests from resources within VPC networks in the same project are classified\n as internal even if the resource they originate from has a public IP address.\n\n- Requests from on-premises resources connected to the VPC network via\n Cloud VPN are considered `internal`.\n\n\u003c!-- --\u003e\n\n- For requests from other App Engine services or from Cloud Run or Cloud Run functions in the same project, connect the service or function to a VPC network and route all egress through the connector, as described in [Connecting to a Shared VPC network](/appengine/docs/standard/connecting-shared-vpc).\n\n### View ingress settings\n\n### Console\n\n1. Go to the App Engine Services page.\n\n [Go to the Services page](https://console.cloud.google.com/appengine/services)\n2. Locate the **Ingress** column. For each service, the value in this column\n shows the ingress setting as one of **All** (default),\n **Internal + Load Balancing** , or **Internal**.\n\n### gcloud\n\nTo view the ingress setting for a service using the gcloud CLI: \n\n```bash\ngcloud app services describe SERVICE\n```\n\nReplace \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with the name of your service.\n\nFor example, to view the ingress settings and other information for the\ndefault service run: \n\n```bash\ngcloud app services describe default\n```\n\n\u003cbr /\u003e\n\n### Edit ingress settings\n\n### Console\n\n1. Go to the App Engine Services page.\n\n [Go to the Services page](https://console.cloud.google.com/appengine/services)\n2. Select the service you wish to edit.\n\n3. Click **Edit ingress setting**.\n\n4. Select the ingress setting that you want from the menu and click\n **Save**.\n\n### gcloud\n\nTo update the ingress setting for a service using the gcloud CLI: \n\n```bash\ngcloud app services update SERVICE --ingress=INGRESS\n```\n\nReplace:\n\n- \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e: The name of your service.\n- \u003cvar translate=\"no\"\u003eINGRESS\u003c/var\u003e: The ingress control you want to apply. One of `all`, `internal-only`, or `internal-and-cloud-load-balancing`.\n\nFor example:\n\n- To update the default service of an App Engine app to accept traffic\n only from Cloud Load Balancing and VPC networks that are in the same\n project:\n\n ```bash\n gcloud app services update default --ingress=internal-and-cloud-load-balancing\n ```\n- To update a service named \"internal-requests\" to accept traffic only from VPC\n networks that are in the same project:\n\n ```bash\n gcloud app services update internal-requests --ingress=internal-only\n ```\n\n\u003cbr /\u003e\n\nEgress settings\n---------------\n\n| **Note:** Egress settings are not available for the PHP runtimes.\n\nIf you use [Serverless VPC Access](/vpc/docs/serverless-vpc-access),\nyou can specify the egress setting for your App Engine service.\n\n\nBy default, only requests to internal IP addresses and internal DNS names are\nrouted through a Serverless VPC Access connector. You can\nspecify the egress setting for your service in your `app.yaml` file.\n\nEgress settings are not compatible with the URL Fetch service.\nUsing the `urlfetch` library ignores egress settings, and requests will not\nroute through a Serverless VPC Access connector.\n\nTo configure the egress behavior of your App Engine service:\n\n1. Add the `egress_setting` attribute to the `vpc_access_connector` field of your\n service's `app.yaml` file:\n\n ```yaml\n vpc_access_connector:\n name: projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e/connectors/\u003cvar translate=\"no\"\u003eCONNECTOR_NAME\u003c/var\u003e\n egress_setting: EGRESS_SETTING\n ```\n\n Replace:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project ID\n - \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e with the region your connector is in\n - \u003cvar translate=\"no\"\u003eCONNECTOR_NAME\u003c/var\u003e with the name of your connector\n - \u003cvar translate=\"no\"\u003eEGRESS_SETTING\u003c/var\u003e with one of the following:\n - `private-ranges-only` Default. Only requests to [RFC 1918](https://tools.ietf.org/html/rfc1918#section-3) and [RFC 6598](https://tools.ietf.org/html/rfc6598#section-7) IP address ranges or internal DNS names are routed to your VPC network. All other requests are routed directly to the internet.\n - `all-traffic` All outbound requests from your service are routed to your VPC network. Requests are then subject to the firewall, DNS, and routing rules of your VPC network. Note that routing all outbound requests to your VPC network increases the amount of egress handled by the Serverless VPC Access connector and can [incur charges](/vpc/pricing#serverless-vpc-pricing).\n2. Deploy the service:\n\n gcloud app deploy\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]