0

To stop a cloudsql instance

gcloud sql instances patch INSTANCE_NAME --activation-policy=NEVER

We tried and it failed for read replicas instances

ERROR: (gcloud.sql.instances.patch) HTTPError 400: Invalid request: Invalid flag for instance role: Activation policy for replica must be set to ALWAYS, currently 'NEVER'..

Now as per the docs, we can't set the NEVER for read replicas.

enter image description here

Is there any way to stop the read replica instance of cloudsql along with main instance properly ?

SRJ
  • 2,092
  • 3
  • 17
  • 36

1 Answers1

1

For us to stop read replication, we have two options:

Disable Replication

  1. Go to Cloud SQL Instance page

  2. Select the read replica you want to disable

    3

  3. Click DISABLE REPLICATION then click on DISABLE when a pop-up display

    4

Delete Read Replica

  1. Go to Cloud SQL Instance page

  2. Select the read replica you want to disable

    3

  3. Click on EDIT and make sure that under Data Protection, Enable deletion protection is unchecked then click on SAVE.

    5

    6

  4. Click DELETE then type in the read-replica-name when a pop-up display

    7

    8

Robert G
  • 1,583
  • 3
  • 13
  • I didn't mention anywhere in my question `delete read replica` :). – SRJ Mar 09 '23 at 22:38
  • If i follow step 1 only and disable replication, it will still incur some cost, I want to stop the instance and start it back after some time. – SRJ Mar 09 '23 at 22:39
  • 1
    @shubham, as of the moment, we could only disable read replica and even if it's disabled, it would still incur charges as it is still an instance based on this documentation on [disabling replication](https://cloud.google.com/sql/docs/postgres/replication/manage-replicas#disable_replication). That is why I added the option to delete the read replica if you don't want to incur charges on the disabled read replica. It is only optional. – Robert G Mar 09 '23 at 22:45