Creating a service account

CREATE USER artie_transfer WITH PASSWORD 'password';

GRANT USAGE ON SCHEMA schema_name TO artie_transfer;
-- Grant access to existing tables
GRANT SELECT ON ALL TABLES IN SCHEMA schema_name TO artie_transfer;
-- Grant read-only access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT SELECT ON TABLES TO artie_transfer;

-- The replication role does not have enough permissions to create publications. 
-- So you will need to create this as well.
CREATE PUBLICATION dbz_publication FOR ALL TABLES;

ALTER USER artie_transfer REPLICATION;

Turning on Logical Decoding Flag

Steps to turn on logical decoding:

  1. Find your database instance and click Edit
  2. Navigate to Flags and find and set cloudsql.logical_decoding to On