Search code examples
node.jsgoogle-cloud-platformgoogle-cloud-sql

Change sql instances in Google Cloud


Is there a script to start/stop MySql instances in Google Cloud every four hours? I can't find it, only console or gcloud and it is not automaticly made, so it is no good.


Solution

  • You could use cloud scheduler for this. You can set this as frequency: 0 */4 * * * (do something every 4 hours). As target you can send a HTTP request to the Google Cloud REST API and patch the activation policy, or you can trigger a cloud function to first check the status of the SQL instance and based on that decide to start or stop it.