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
1
Open the Cloud SQL instance
In the Google Cloud Console, select the project that contains your Cloud SQL instance.
2
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.

3
Restart the instance
This change requires the instance to restart before it takes effect.

4
Verify the flag
Confirm the change under Flags on the Overview page, or run:
Grant the replication role
After creating the sync user (see the common setup), grant the replication attribute: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: