Python 2.7 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Python 2.7 アプリケーションをデプロイできなくなります。既存の Python 2.7 アプリケーションは、
非推奨日以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Python に移行することをおすすめします。
App Engine の接続に関する質問
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このページでは、サーバーレス VPC アクセスと内部 IP アドレスの使用に関連する手順など、App Engine でよく使用される接続方式について説明します。
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 Service A へのアクセスを App Engine Service B からのみ有効にする場合)は、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 Auth Proxy が Cloud SQL インスタンスに接続できるように正しく構成されていることを確認してください。
- Cloud SQL Admin API が有効になっている必要があります。
- App Engine アプリのサービス アカウントには適切な権限が必要です。
- インスタンス接続名にはリージョンを含める必要があります。
トラブルシューティングを行ってもエラー メッセージが表示される場合は、Google Cloud サポートにお問い合わせください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","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 UTC。"],[[["\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."]]