Google Cloud SQL
Learn how to provision databases in instances running in Google Cloud SQL
You can easily connect Humanitec to Google Cloud SQL. The next paragraphs explain how.

Prerequisites

  • 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

You can add the GCP account in the Organization Settings.
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].
UI
CLI
API
  1. 1.
    Click on the Accounts tab.
  2. 2.
    Select Google Cloud Platform.
  3. 3.
    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).
  4. 4.
    Once you clicked on Authorize, you will see the account at the top of the accounts list.
New GCP Account
Our CLI is currently in closed beta. Please contact us if you want to learn more.
Accounts can be added via the Create Resource Account endpoint.

Add Resource Definition

You can easily connect Humanitec to a GCP managed database instance. The following paragraph explains how.
UI
CLI
API
  1. 1.
    Start on the Resources Management screen and click on the Show all resources button. An overlay with all available resource categories and types will be presented to you.
  2. 2.
    Below Data storages select Postgres, which opens a dialog.
  3. 3.
    Add a memorable ID for this Resource Definition and select a driver, here - postgres-sql.
  4. 4.
    Below Credentials make sure your GCP account is selected.
  5. 5.
    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.
  6. 6.
    Add the values and click Create.
  7. 7.
    Once created, the Resource Definition will appear at the top of the resources list.
Add Resource Definition
Our CLI is currently in closed beta. Please contact us if you want to learn more.
Resource definitions can be created via the Create Dynamic Resource endpoint.

Define Matching

Next, you can configure matching criteria for your postgres database. This enables you to define specific environments or applications to be deployed to this resource.
UI
CLI
API
By clicking on your postgres database in the list of resources, the Matching row will expand and allow you to add or remove matching criteria. Each resource can be matched to specific Environment Types, App IDs, Environment IDs or Resource IDs. Empty fields are automatically resolved to match all values of the given category.
Define Matching
Based on this Resource Definition, during the deployment on any of the matching environments, an Active Resource will be provisioned if required.
Our CLI is currently in closed beta. Please contact us if you want to learn more.
Matching criteria can be created via the Create new Matching Criteria endpoint.
Last modified 2mo ago