Java 8 已达到支持终止期限,并将于 2026 年 1 月 31 日
弃用。弃用后,您将无法部署 Java 8 应用,即使您的组织之前曾使用组织政策重新启用旧版运行时的部署,也无法部署。现有的 Java 8 应用在
弃用日期之后将继续运行并接收流量。我们建议您
迁移到最新支持的 Java 版本。
App Engine 连接问题
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页面介绍了常用的 App Engine 连接策略,包括与使用无服务器 VPC 访问通道和内部 IP 地址相关的步骤。
从 VPC 连接到 App Engine 实例
在从 Google 的无服务器产品调用 Virtual Private Cloud (VPC) 网络时,无服务器 VPC 访问通道非常有用,但您无法使用内部 IP 地址访问 App Engine 实例。
如需在未分配外部 IP 地址的情况下使用内部 IP 地址从 VPC 网络连接到 App Engine,请执行以下操作:
- 设置专用 Google 访问通道。确保 App Engine 服务使用启用了专用 Google 访问通道的子网。
- 使用 Private Service Connect 端点。确保该端点已连接到启用了专用 Google 访问通道的子网。
- 将流量发送到 Private Service Connect 端点。确保该端点已连接到子网。
具有外部 IP 地址的 App Engine 实例可以将流量发送到 Private Service Connect 端点,无需满足任何要求。
出站连接重置
在更新或重启底层基础设施时,Google Cloud 可能会偶尔终止和替换从您的应用到 VPC 和互联网的连接流。如果您的应用重复使用长期有效的连接,我们建议您将应用配置为重新建立连接,以避免重复使用无效连接。
自定义 App Engine 服务之间的访问权限
如果您使用多个 App Engine 服务并希望在服务之间以不同方式配置访问权限(例如,您希望仅从 App Engine 服务 B 实现对 App Engine 服务 A 的访问),则可以结合使用 App Engine 和 Identity-Aware Proxy (IAP)。
如需了解详情,请参阅控制对网站和应用的访问权限和 IAP 文档。
将 App Engine 连接到 Cloud SQL 专用 IP 地址
如需通过专用 IP 地址将 App Engine 应用连接到 Cloud SQL 实例,请使用以下选项之一:
排查将 App Engine 应用连接到 Cloud SQL 时出现的问题
使用 Unix 套接字通过 Cloud SQL 部署旧版 App Engine 标准环境应用时,如果您的应用未正确配置为连接到 Cloud SQL 实例,您可能会看到一些错误消息。如需了解配置应用的详细步骤,请参阅从 App Engine 标准环境连接。
以下警告消息表示 App Engine 能够回退到旧版连接方法以成功完成操作:
CloudSQL warning: your action is needed to update your application and avoid potential disruptions. Please see https://cloud.google.com/sql/docs/mysql/connect-app-engine-standard for additional details: ...
以下错误消息表示连接到 Cloud SQL 的操作未成功完成:
Cloud SQL connection failed. Please see https://cloud.google.com/sql/docs/mysql/connect-app-engine-standard for additional details: ...
对于这两种错误消息,请检查以下内容,确保 Cloud SQL 身份验证代理已正确配置为连接到 Cloud SQL 实例:
- 必须启用 Cloud SQL Admin API。
- App Engine 应用的服务账号必须具有正确的权限。
- 实例连接名称必须包含区域。
如果问题排查后失败消息仍然存在,请与Google Cloud 支持团队联系以获取帮助。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-09-04。
[[["易于理解","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-04。"],[[["\u003cp\u003eServerless VPC Access facilitates connections from Google's serverless offerings to a Virtual Private Cloud (VPC), but it does not allow direct access to App Engine instances using internal IP addresses.\u003c/p\u003e\n"],["\u003cp\u003eConnecting to App Engine from a VPC network with an internal IP address requires setting up Private Google Access and using a Private Service Connect endpoint.\u003c/p\u003e\n"],["\u003cp\u003eWhen you have multiple App Engine services and you need to restrict access between them, you can utilize App Engine with Identity-Aware Proxy (IAP) to control permissions.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine apps can connect to Cloud SQL instances over private IP addresses using either the Serverless VPC Access connector for standard environments or by deploying the app within the same VPC network as the Cloud SQL instance for flexible environments.\u003c/p\u003e\n"],["\u003cp\u003eTroubleshooting connection failures between App Engine and Cloud SQL often involves ensuring the Cloud SQL Admin API is enabled, the service account has correct permissions, and the instance connection name is correctly formatted, which will involve the region.\u003c/p\u003e\n"]]],[],null,["# App Engine connectivity questions\n\nThis page describes commonly used App Engine connectivity\nstrategies, including steps related to using [Serverless VPC Access](/vpc/docs/serverless-vpc-access) and internal IP addresses.\n\n- [Connect from VPC to App Engine instances](#set-up-connectivity-from-vpc-to-app-engine)\n- [Connect App Engine to Cloud SQL private IP addresses](#sql-connectivity)\n- [Customize access permissions between App Engine services](#access-permissions)\n\nConnect from VPC to App Engine instances\n----------------------------------------\n\nServerless VPC Access is useful when making calls from Google's\nserverless offerings to a Virtual Private Cloud (VPC) network, but you can't\naccess App Engine instances using an internal IP address.\n\nTo connect to App Engine from the VPC network using an\ninternal IP address without an assigned external IP address, do the following:\n\n1. Set up [Private Google Access](/vpc/docs/private-google-access). Ensure that the App Engine service uses a Private Google Access-enabled subnet.\n2. Use a [Private Service Connect](/vpc/docs/private-service-connect) endpoint. Ensure that the endpoint is connected to the Private Google Access-enabled subnet.\n3. Send traffic to the Private Service Connect endpoint. Ensure that the endpoint is connected to the subnet.\n\nApp Engine instances with external IP addresses can send traffic to\nPrivate Service Connect endpoints without any requirements.\n\n### Outbound connection resets\n\nGoogle Cloud can occasionally terminate and replace connection streams from your\napplication to both [VPC](/appengine/docs/standard/connecting-vpc)\nand the internet when updating or restarting the underlying infrastructure. If your application reuses long-lived connections, we recommend that you configure your application to\nre-establish connections to avoid the reuse of a dead connection.\n\nCustomize access permissions between App Engine services\n--------------------------------------------------------\n\nWhen you have multiple App Engine services and\nwant to configure access permissions differently between services (for example,\nyou want to enable access to App Engine Service A only from App Engine Service B), you can use\n[App Engine with Identity-Aware Proxy (IAP)](/solutions/authenticating-web-users).\n\nFor more information, see [Controlling access to websites and apps](/solutions/authenticating-web-users) and [IAP documentation](/iap/docs/authenticate-users-google-accounts).\n\nConnect App Engine to Cloud SQL private IP addresses\n----------------------------------------------------\n\nTo connect your App Engine apps to [Cloud SQL](/sql)\ninstances over private IP addresses, use one of the following options:\n\n- **App Engine standard environment** : Use the [Serverless VPC Access connector](/vpc/docs/serverless-vpc-access) to connect to Cloud SQL over internal IP addresses. For more information, see [Connecting from App Engine standard environment to Cloud SQL](/sql/docs/mysql/connect-app-engine-standard#configuring).\n- **App Engine flexible environment** : Deploy your flexible environment app in the same VPC network as your Cloud SQL instance. Your app should now be able to connect directly using Cloud SQL instance's private IP address. For more information, see [Connecting from App Engine flexible environment to Cloud SQL](/sql/docs/mysql/connect-app-engine-flexible#configuring).\n\n### Troubleshoot issues connecting an App Engine app to Cloud SQL\n\nWhen deploying an older App Engine standard environment app with Cloud SQL using Unix\nsockets, you might see a few error messages if your app isn't correctly\nconfigured to connect to a Cloud SQL instance. For detailed steps to\nconfigure your app, see [Connect from App Engine standard environment](/sql/docs/mysql/connect-app-engine-standard#configure).\n\nThe following warning message indicates that App Engine was able to fall\nback on a legacy connection method to complete the operation successfully: \n\n```\nCloudSQL warning: your action is needed to update your application and avoid potential disruptions. Please see https://cloud.google.com/sql/docs/mysql/connect-app-engine-standard for additional details: ... \n```\n\nThe following error message indicates that the operation to connect to\nCloud SQL wasn't completed successfully: \n\n```\nCloud SQL connection failed. Please see https://cloud.google.com/sql/docs/mysql/connect-app-engine-standard for additional details: ...\n```\n\nFor both error messages, check the following to ensure that the\n[Cloud SQL Auth proxy](/sql/docs/mysql/connect-admin-proxy) is correctly\nconfigured to connect to a Cloud SQL instance:\n\n- The Cloud SQL Admin API must be enabled.\n- The service account for the App Engine app must have the correct permissions.\n- The instance connection name must include the region.\n\nIf the failure message persists after troubleshooting, contact\n[Google Cloud Support](https://support.google.com/cloud/#topic=3473162)\nfor assistance."]]