This page provides language-specific links to information about how to set up a connection from an App Engine application and a PostgreSQL instance.
For information about the various options for connecting to Cloud SQL, see Connection Options for External Applications.
General information for connecting to Cloud SQL from App Engine
When you are connecting to Cloud SQL from App Engine, keep these best practices in mind:
- App Engine has the ability to automatically create more instances
when load increases. If the number of App Engine instances increases
beyond what the Cloud SQL instance is sized to handle, your
Cloud SQL instance will not be able to meet the demand. You can avoid this
issue by setting the
max_instancesvalue for the
basic_scalingelement in your
app.yamlfile. For more information, see Scaling elements.
- Open database connections consume resources; your application should always close connections when they are no longer being used. For App Engine standard environment, there is a hard limit on the number of connections an App Engine instance can have open to Cloud SQL. If your application requires more open connections, consider using connection pooling.
App Engine standard environment to PostgreSQLFor information about connecting from App Engine standard environment to Second Generation instances, see the App Engine documentation for your programming language:
|Java||Using Cloud SQL for PostgreSQL with Java|
|Node.js||Using Cloud SQL for PostgreSQL with Node.js|