> ## Documentation Index
> Fetch the complete documentation index at: https://www.integrate.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Cloud SQL PostgreSQL source for ELT & CDC

> Configure Google Cloud SQL for PostgreSQL as a CDC source in Integrate.io ELT & CDC. Enable logical decoding and grant the replication role.

This page covers the **Google Cloud SQL-specific** steps to prepare your PostgreSQL instance for ELT & CDC. After completing them, follow the common setup (sync user grants, heartbeat table, publication, and replication slot) on the [PostgreSQL source for ELT & CDC](/cdc/postgresql) page.

## Requirements

* Cloud SQL for PostgreSQL **version 10 or above**.
* Connect to the **primary** instance. Logical replication only works on the primary.
* Tables with a `PRIMARY KEY`.

## Enable logical replication

<Steps>
  <Step title="Open the Cloud SQL instance">
    In the Google Cloud Console, select the project that contains your Cloud SQL instance.
  </Step>

  <Step title="Add the cloudsql.logical_decoding flag">
    Edit the instance, open the **Flags** section, add `cloudsql.logical_decoding` and set it to `ON`, then save your changes.

    <Frame>
      <img src="https://mintcdn.com/integrateio/SIDFEDRgXpxG0yrn/images/cdc/sources/image-87.png?fit=max&auto=format&n=SIDFEDRgXpxG0yrn&q=85&s=6568ac1f9eac7880697f5c9aa65ef2a6" alt="Adding cloudsql.logical_decoding flag set to ON in Cloud SQL instance" width="1164" height="964" data-path="images/cdc/sources/image-87.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/integrateio/SIDFEDRgXpxG0yrn/images/cdc/sources/image-88.png?fit=max&auto=format&n=SIDFEDRgXpxG0yrn&q=85&s=eb89a5cafb0653410acc4321ae100670" alt="Saving the logical decoding flag changes in Cloud SQL instance settings" width="972" height="602" data-path="images/cdc/sources/image-88.png" />
    </Frame>
  </Step>

  <Step title="Restart the instance">
    This change requires the instance to restart before it takes effect.

    <Frame>
      <img src="https://mintcdn.com/integrateio/SIDFEDRgXpxG0yrn/images/cdc/sources/image-89.png?fit=max&auto=format&n=SIDFEDRgXpxG0yrn&q=85&s=f1745fc5d164bdce0efd7c89626e59d9" alt="Cloud SQL instance restart prompt after flag changes" width="1200" height="121" data-path="images/cdc/sources/image-89.png" />
    </Frame>
  </Step>

  <Step title="Verify the flag">
    Confirm the change under **Flags** on the Overview page, or run:

    ```sql theme={null}
    SHOW cloudsql.logical_decoding;
    ```
  </Step>
</Steps>

## Grant the replication role

After creating the sync user (see the [common setup](/cdc/postgresql#setup-steps-customer-managed)), grant the replication attribute:

```sql theme={null}
ALTER ROLE integrateio WITH REPLICATION;
```

## Next: common setup

Continue with the canonical PostgreSQL setup for the remaining steps — sync user privileges (`USAGE`, `SELECT`, `REFERENCES`), heartbeat table, publication, and replication slot:

<Card title="PostgreSQL source for ELT & CDC" icon="arrow-right" href="/cdc/postgresql" horizontal />

<CardGroup cols={2}>
  <Card title="SSH Tunnel" icon="arrow-right" href="/cdc/ssh-tunnel" horizontal />

  <Card title="PostgreSQL PrivateLink" icon="arrow-right" href="/cdc/postgresql-privatelink-set-up" horizontal />
</CardGroup>
