Set up backup repository for database services

Before using backup and restore services for gdcloud CLI Database Services (DBS), you must be a Platform Administrator (PA) and set up a valid B4GDC BackupRepository named dbs-backup-repository in the system cluster to use as the target for your backups.

You have the option to set up a backup repository through the B4GDC UI or manually. To set up manually, follow the proceeding steps.

Set up DBS backup repository manually

This section assumes that you already have an S3-compatible endpoint available and that you have created a bucket to use as the backup repository.

First, you must create the S3 credentials (access-key and access-key-id) as a secret in the system cluster. For example:

apiVersion: v1
kind: Namespace
metadata:
  name: "s3-secret-ns"
  labels:
    name: "s3-secret-ns"
---
apiVersion: v1
kind: Secret
metadata:
  namespace: "s3-secret-ns"
  name: "s3-secret"
type: Opaque
data:
  access-key-id: YWNjZXNzS2V5MQ== # echo -n accessKey1 | base64 -w0
  access-key:  dmVyeVNlY3JldEtleTE= # echo -n verySecretKey1 | base64 -w0
---

Then, you can create a BackupRepository named dbs-backup-repository in the system cluster to use these credentials. For example:

apiVersion: hybrid.gpc.io/v1
kind: BackupRepository
metadata:
  name: dbs-backup-repository
spec:
  secretReference:
    namespace: "s3-secret-ns"
    name: "s3-secret"
  endpoint: "https://storage.googleapis.com"
  type: "S3"
  s3Options:
    bucket: "BUCKET_NAME"
    region: "us-east-1"
    forcePathStyle: true
  importPolicy: "ReadWrite"
  # Force attachment for convenience.
  force: true