Skip to main content

Google Cloud SQL Backups

Checks if a Google Cloud SQL instance has been successfully backed up recently.

gcs-database.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: database-backup-example
spec:
schedule: "@every 5m"
databaseBackup:
- name: backup
maxAge: 6h
gcp:
project: google-project-name
instance: cloudsql-instance-name
FieldDescriptionSchemeRequired
gcpConnect to GCP project and instanceGCPDatabaseYes
maxAgeMax age for backup allowed, e.g. 5h30mDuration
nameName of the check, must be unique within the canarystringYes
descriptionDescription for the checkstring
iconIcon for overwriting default icon on the dashboardstring
labelsLabels for checkmap[string]string
testEvaluate whether a check is healthyExpression
displayExpression to change the formatting of the displayExpression
transformTransform data from a check into multiple individual checksExpression
metricsMetrics to export from[]Metrics

Duration

Durations are strings with an optional fraction and unit e.g. 300ms, 1.5h or 2h45m. Valid time units are ms, s, m, h.

GCPDatabase

FieldDescriptionSchemeRequired
projectGCP project namestringYes
instanceGoogle CloudSQL instance namestringYes
Connection
connectionPath of an existing connection e.g. connection://gcp/. Mutually exclusive with credentials
Connections
credentialsGCP Access Token File. EnvVarYes

Connecting to GCP

There are 3 options when connecting to GCP:

  1. GKE workload identity (the default if no connection or credentials is specified)
  2. connection, this is the recommended method, connections are reusable and secure
database-backup-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: database-backup-example
spec:
schedule: "@every 5m"
databaseBackup:
- name: backup
maxAge: 6h
gcp:
project: google-project-name
instance: cloudsql-instance-name
gcpConnection:
connection: connection://gcp/internal
  1. accessKey and secretKey EnvVar with the credentials stored in a secret.
gcs-database-backup.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: database-backup-example
spec:
schedule: "@every 5m"
databaseBackup:
- name: backup
maxAge: 6h
gcp:
project: google-project-name
instance: cloudsql-instance-name
gcpConnection:
credentials:
valueFrom:
secretKeyRef:
name: gcp-credentials
key: AUTH_ACCESS_TOKEN