App Engine 实例和 Compute Engine 实例属于同一专用内部网络。
您的 App Engine 应用可以与同一项目中的 Compute Engine 上托管的服务通信,而无需借助公共互联网。在许多情况下,您的应用使用实例的内部 IP 地址连接到服务,而无需为数据库分配外部公共 IP 地址。如有需要,您可以分配公共 IP 地址以允许从 Google Cloud外部访问数据库。
您可以使用 Google Cloud Marketplace 将 Redis、MongoDB、PostgreSQL、Cassandra、Hadoop 和 Microsoft SQL Server 等多种常见的第三方数据库快速部署到 Compute Engine。如需详细了解如何部署 MySQL 或 PostgreSQL,请参阅以下指南。
其他云服务商
App Engine 应用可以连接到其他公有云上托管的外部数据库,前提是这些数据库服务器和您的防火墙已正确配置,可以接受连接。您的 App Engine 应用使用该外部服务的公共 IP 地址通过互联网进行连接。
[[["易于理解","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\u003eApp Engine applications can utilize various storage solutions, including Google Cloud services, third-party databases, and on-premises databases.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud offers storage services like Firestore in Datastore mode, Cloud SQL for MySQL and PostgreSQL, and Cloud Storage, which are recommended for App Engine flexible environment apps.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine can communicate with services hosted on Compute Engine within the same project using the instance's internal IP address, without needing a public IP.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine apps can connect to external databases hosted on other public clouds or managed by third-party vendors via the Internet using the service's public IP address.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine can use a VPN to access on-premises databases using the database server's internal IP address, without exposing the database server to the public internet.\u003c/p\u003e\n"]]],[],null,["# Understanding data and file storage\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nTo store data and files on App Engine, you can use Google Cloud services\nor any other storage service that is supported by your language and is\naccessible from your App Engine instance. Third-party databases\ncan be hosted on\n[Compute Engine](/compute), hosted on another cloud provider,\nhosted on premises, or managed by a third-party vendor.\n\nGoogle Cloud storage services\n-----------------------------\n\nFor App Engine apps running in the flexible environment, we recommend\none of the following Google Cloud storage services:\n\n- [Firestore in Datastore mode](/appengine/docs/flexible/using-firestore-in-datastore-mode) to store data in a NoSQL database. Note that Firestore in Datastore mode is available for all runtimes except the .NET runtime.\n- [Cloud SQL for MySQL](/sql/docs/mysql/connect-app-engine-flexible) to store data in a MySQL database.\n- [Cloud SQL for PostgreSQL](/sql/docs/postgres/connect-app-engine-flexible) to store data in a PostgreSQL database.\n- [Cloud Storage](/appengine/docs/flexible/using-cloud-storage) to read and write files in the runtime environment, as well as [store and serve static files](/appengine/docs/flexible/serving-static-files), such as movies or images or other static content.\n\nSee a complete list of the Google Cloud storage products on the\n[Cloud Storage Products page](/products/storage).\n\nHosting on Compute Engine\n-------------------------\n\nApp Engine instances are part of the same [private internal\nnetwork](/vpc/docs/vpc#app-engine-comm) as Compute Engine instances.\nYour App Engine app can communicate with services hosted on\nCompute Engine within the same project without going through the public\ninternet. In many cases, your app connects to the service using the\ninstance's internal IP address without needing to assign the database an\nexternal, public IP address. If desired, you can assign a public IP address to\nallow the database to be accessed from outside of Google Cloud.\n\nMany popular third-party databases such as Redis, MongoDB, PostgreSQL,\nCassandra, Hadoop, and Microsoft SQL Server can be quickly deployed to\nCompute Engine by using the\n[Google Cloud Marketplace](/marketplace). See the following guides for details about\ndeploying [MySQL](/solutions/setup-mysql) or\n[PostgreSQL](/solutions/setup-postgres).\n\n\nOther cloud providers\n---------------------\n\nApp Engine apps can connect to external databases that are hosted on\nother public clouds as long as those database servers and your firewall are\nconfigured properly to accept connections. Your App Engine app connects\nover the Internet using that external service's public IP address.\n\nDatabases managed by a third-party vendor\n-----------------------------------------\n\nThere are many vendors offering managed database services such as\n[mLab](/mongodb) for MongoDB, Redis Labs offers hosted\n[Redis caching](https://redislabs.com/redis-enterprise/cloud/). These vendors handle\nhosting, configuration, and maintenance of databases. App Engine can\nconnect to these external services over the Internet, in the same way as other\npublic clouds by using that service's public IP address.\n\nOn premises\n-----------\n\nIf you have existing on-premises databases that you want to make accessible to\nyour App Engine app, you can either configure your internal\nnetwork and firewall to give the database a public IP address or connect using a\nVPN.\n\nSetting up [Cloud VPN](/network-connectivity/docs/vpn) allows your App Engine\napp to access your on-premises network without directly exposing the\ndatabase server to the public internet. Because App Engine and\nCompute Engine use the same networking infrastructure, you can use the VPN\nconnection to establish a connection between the App Engine app\nand your on-premises database using the database server's internal IP address.\n\nProduction considerations\n-------------------------\n\nApp Engine can be configured to automatically scale your application\n[horizontally](https://wikipedia.org/wiki/Scalability#Horizontal_and_vertical_scaling)\nbased on various metrics. Unlike web applications, databases often\nrequire non-trivial changes to respond to scale. In production applications,\nApp Engine can quickly overwhelm a database during traffic spikes. You\nshould take the anticipated average traffic load and load during spikes into\nconsideration when configuring and deploying databases."]]