Announcing Cloud SQL Node.js connector general availability
Luke Schlangen
Developer Advocate, Google Cloud
Ruy Adorno
Software Engineer
The Cloud SQL Node.js connector is the easiest way to securely connect your Node.js application to your Cloud SQL database. With today’s General Availability announcement, we now recommend using the Cloud SQL Node.js connector.
When to use the Cloud SQL Node.js connector
Cloud SQL has two types of connectors:
- Language-specific connectors - Available for Java, Python, Go, and now Node.js
- Cloud SQL Auth proxy - A good choice when a language-specific connector is not available
These connectors come with significant advantages over a traditional database connection. We laid out a few of the benefits of using a connector in our previous blog post, Understanding Cloud SQL connectors. With code-level control, the Cloud SQL Node.js connector is the most convenient way to securely connect your application to your database.
Try it out
The Cloud SQL Node.js Connector README file includes usage documentation for PostgreSQL, MySQL, and SQL Server showing how to integrate the connector into your application. To show just how easy it can be, we’ve released a Codelab for How to connect a Node.js application on Cloud Run to a Cloud SQL for PostgreSQL database.
In a single file, this application:
- accepts HTTP requests
- securely connects to the Cloud SQL for PostgreSQL database using a service account with automatic IAM database authentication
- stores the time of the HTTP request in the database
- returns the timestamp of the last five visits
The Node.js connector simplifies the experience of connecting your application to your database so that developers can focus on building application features. Practices like automatic IAM authentication — which allows you to avoid using and rotating passwords — improve your application security, save you time today, and save you time in the future. To get started with the connector and see an example of those recommended practices in action, follow the link to the Codelab.