Create a Cloud SQL - PostgreSQL connector

Stay organized with collections Save and categorize content based on your preferences.

You're viewing Apigee X documentation.
View Apigee Edge documentation.

The Cloud SQL - PostgreSQL Connector lets you insert, read, update and delete rows in a PostgreSQL database and use the resulting output in an integration. This page provides a reference for configuring a Cloud SQL for PostgreSQL connection and using it with Apigee Integration.

PostgreSQL is a fully-managed database service that helps you set up, maintain, manage, and administer your PostgreSQL relational databases on Google Cloud.

For a hands-on introduction, try one of the PostgreSQL quickstarts.

Before you begin

Supported PostgreSQL versions: 7.4 and later

Before creating a Cloud SQL for PostgreSQL connection, do the following in your Google Cloud project::

  • Grant the following roles to the service account that you want to use to create the connection:
    • roles/cloudsql.editor
    • roles/secretmanager.viewer
    • roles/secretmanager.secretAccessor
  • Enable the following services:
    • (Apigee API)
    • (Secret Manager API)
    • (Connector Platform API)
    • (Cloud SQL Admin API)

If these services have not been enabled for your project previously, you are prompted to enable them when creating the connection in the Create Connection page.

Create a Cloud SQL for PostgreSQL connection

  1. In the Cloud console, go to Apigee > Connectors page and select or create a Google Cloud project.

    Go to the Connections page

  2. Click + CREATE NEW to open the Create Connection page.
  3. Configure the connection:
    1. In the Create Connection section, complete the following:
      • Connector: Select GCP > Cloud SQL - PostgreSQL from the drop down list of available connectors.
      • Connector version: Select the connector version from the drop down list of available versions.
      • In the Connection Name field, enter a name for the connection instance.

        Connection names must meet the following criteria:

        • Connection names can use letters, numbers, or hyphens.
        • Letters must be lower-case.
        • Connection names must begin with a letter and end with a letter or number.
        • Connection names cannot exceed 63 characters.
      • Optionally, add a Description of the connection instance.
      • Service Account: Select a service account that has the required roles.
      • Project ID: Enter the of the Google Cloud project where the PostgreSQL instance resides.
      • Database Region: Enter the name of the region where the PostgreSQL instance resides.
      • Instance ID: Enter the ID of the PostgreSQL instance to connect with.
      • Database Name: Enter the name of the PostgreSQL database to connect with.
      • Optionally, click + ADD LABEL to add a label to the Connection in the form of a key/value pair.
      • Click NEXT.
    2. Location: Choose the location for the connection.
      • Select a location where Apigee is available from the Region drop-down list.

        Supported regions for connectors include:

        • asia-east1
        • asia-northeast1
        • asia-south1
        • asia-southeast1
        • australia-southeast1
        • europe-west1
        • europe-west2
        • europe-west3
        • europe-west4
        • europe-west6
        • northamerica-northeast1
        • southamerica-east1
        • us-central1
        • us-east1
        • us-east4
        • us-west1
        • us-west2
      • Click NEXT.
    3. Authentication: Provide authentication credentials for your connection instance, if required.

      For Cloud SQL - PostgreSQL connections, you can provide credentials in the form of a User and Password combination.

      To configure authentication using a User and Password combination, enter the following information:

      • Username: Enter the PostgreSQL username for the connection.
      • Password: Enter the Secret Manager secret containing the password associated with the PostgreSQL username.
        • If you have previously created a secret, and it is not available in the drop down list, select DON'T SEE YOUR SECRET? ENTER SECRET RESOURCE ID to open the Add a secret by resource ID dialog.

          Copy and paste the resource ID from Secret Manager

          • To use the latest version, copy and paste the resource ID from the parent secret, in the format: "projects/project-number/secrets/secret-name"
          • To select a specific version, copy and paste the resource ID for that specific version, in the format "projects/project-number/secrets/secret-name/versions/1"

          Click ADD SECRET to add the secret and close the dialog.

        • If you have not created a secret for use with Cloud SQL - PostgreSQL , click ADD A NEW SECRET to open the Create Secret dialog.

          Enter the secret details:

          • Name: Enter the secret name.
          • Secret value: Enter the contents of the secret.
          • Optionally, click + ADD LABEL to add a label in the form of a key/value pair.
      • Secret version: Select the version of the Password secret from the list of available versions in the drop-down.
      • Click NEXT.
    4. Review: Review your connections's configuration details. In this section, the Connection details and Authentication details of the new connection are displayed for your review.
  4. Click Create.

Create a Connectors task

After you create a Cloud SQL for PostgreSQL connection, it becomes available in Apigee integrations. You can then use the connection to configure the Connectors tasks in your integrations. For more information, see Configure the Connectors task.