DEV Community

Gaurav Pande
Gaurav Pande

Posted on

Automate Cloud SQL Maintenance Upgrades on GCP

What's this?

Organizations that use Cloud provider DBaaS solutions face a common scenario where they need to Upgrade there DB instances frequently due to patching process or Upgrading to Minor Patch.

This article talks about one of the way to automate and handle these types of Patch/Minor Version Upgrades on Google Cloud Platform using Automate Cloud SQL Maintenance.

Tools Used:

  • Github Actions for CD.
  • Slack Incoming Webhook for Alerting/Notification.

Pre-requisite:

  • The Github Action workflow uses GCP Workload Identity Federation thus would need a WIF Pool and Github OIDC provider setup along with a GCP Service Account with Cloud SQL Admin role. Check How to enable Github Action to use WIF for GCP

  • A Self Hosted Github Runner on your GCP Environment. Example can be Bastion GCE VM having gcloud cli installed can be used for this purpose.

  • An Incoming WebHook Enabled on slack and a Webhook Endpoint URL to post Notifications on Slack.

Workflow:

This uses Github Actions as a CD tool to achieve upgrade of GCP Cloud SQL instances by running action as a cronjob and checks if new version is available. If found it notifies user on slack and proceeds with an Upgrade to that new Version and once Upgrade is completed Notifies user again about completion on slack.

Top comments (0)