Google Cloud SQL

Learn how to provision databases in instances running in Google Cloud SQL

To provision PostgreSQL dynamically, add it as a Dynamic Resource Definition. The database will be provisioned during deployment time and destroyed when its introductory Environment is deleted.


  • You must have a Service Account with the Cloud SQL Client role.

  • You must create a key for this service account in JSON form. See Google's account keys documentation for more information. The access key must use the GCP Console/gcloud format (i.e., the first example in the linked documentation).

  • You must have the CloudSQL Admin API enabled for your project.

Add GCP Account

This guide explains how to connect PostgreSQL via the Google Cloud Platform account. If you need to connect it using a different cloud provider, contact us at [email protected]. You can add the GCP account in the Organization Settings.

  • Click on the Dynamic Resources tab.

  • Select Google Cloud Platform.

Add GCP account
  • Humanitec will ask you to provide an Account Name (a memorable name that will be displayed for this account) and a Service Account Access Key JSON (see prerequisites).

  • Once you have added your account you will see the available Dynamic Resource Definitions.

GCP account added

Add Dynamic Resource Definition

  • In Organization Settings, Dynamic Resource tab, click on your Google Cloud Platform Account that you want to use for adding your PostgreSQL.

  • Click on PostgreSQL resource definition.

  • Add a memorable ID for this Resource Definition and select a driver, here - cloudsql.

  • Based on your resource driver, a form will be shown with the required driver parameters which will be passed to the driver on every resource creation. Add the values and click create.

Add dynamic resource
  • Once created, the Resource Definition will appear in the list.

  • Assign your Resource Definition to an Environment Type.

Dynamic resource list

Based on this Resource Definition, during the deployment on any of the matching environments, an Active Resource will be provisioned if required.