Skip to main content

Database Backup Policies

Overview

A Database Backup Policy automates offsite backups for managed databases. It bundles the S3 destination, schedule, retention, and encryption settings into one reusable object. Attach one or more databases to a policy and the system runs full backups, incremental backups, and (optionally) continuous transaction log archiving on the schedule you set.

It is the same idea as Instance Backup Policies but for the managed database resource instead of a virtual machine.


Concepts

  • Managed database - A database (MySQL, MariaDB, or PostgreSQL) the platform runs for the customer. See Managed Databases.
  • S3-compatible storage - A storage service that speaks the Amazon S3 API. AWS S3, RustFS, Wasabi, and similar.
  • Bucket - The S3 namespace your backups are written into. You point the policy at the bucket plus an access key and secret key that can write to it.
  • Full backup - A complete copy of the database at one point in time.
  • Incremental backup - A copy of only the changes since the last full backup. Smaller and faster than a full.
  • Chain - One full backup plus all the incrementals that depend on it.
  • PITR (Point-in-Time Recovery) - The ability to restore the database to any second within a recovery window, not just to the moment a backup was taken. Works by continuously archiving the database's transaction log (binary log for MySQL/MariaDB, WAL for PostgreSQL).
  • Transaction log - The running log of every change the database makes. PITR replays it on top of a full backup to roll the database forward to a precise instant.
  • Retention - How long to keep old backups before deleting them.
  • AES-256 - A symmetric encryption algorithm. Optional client-side encryption before upload so the data is unreadable in the bucket.
  • Replica - A read-only copy of the database that follows the primary. If a healthy replica exists, the backup runs against it so the primary's performance is not affected.

Prerequisites

Before you create a policy:

  1. An S3-compatible bucket already exists, with an access key and secret key that have read/write/delete permission on it.
  2. At least one managed database is Active.
  3. The S3 endpoint is reachable from the database server over HTTPS.
warning

The S3 credentials need s3:PutObject, s3:GetObject, s3:DeleteObject, and s3:ListBucket on the target bucket. Missing permissions cause backup failures.


Admin: Configuring Database Backup Policies

Open the admin sidebar and go to Managed Databases then Backup Policies.

Admin Database Backup Policies

Click Add Policy to open the create form, then fill in the sections below.

Create database backup policy form

General

FieldWhat it means
UserThe owner of the policy. The databases attached to this policy must belong to the same user.
NameA label, for example "Production Daily".

S3 Configuration

FieldWhat it means
S3 EndpointHostname of the S3-compatible endpoint (e.g. s3.us-east-1.amazonaws.com).
S3 BucketTarget bucket name.
S3 RegionBucket region (e.g. us-east-1).
S3 Access KeyIAM key with read/write/delete on the bucket.
S3 Secret KeyMatching secret.
S3 Path PrefixOptional folder inside the bucket (e.g. backups/production).
tip

Click Test Connection to verify the credentials before saving.

Schedule

FieldValuesWhat it means
Full Backup FrequencyDaily or WeeklyHow often a full backup runs.
Full Backup TimeHH:MM (UTC)Time of day to start full backups.
Full Backup DaySunday to SaturdayOnly used for weekly schedules.
Incremental FrequencyNone, 1h, 2h, 4h, 6h, 12hHow often incremental backups run between full backups.

PITR

FieldWhat it means
PITR EnabledTurn point-in-time recovery on or off.

When PITR is on, the system automatically configures transaction log archiving on any database attached to the policy (binary logs for MySQL/MariaDB, WAL for PostgreSQL). That stream lets you restore to any moment inside the retention window.

Retention

FieldDefaultWhat it means
Retain Full Backups7How many full backups to keep.
Retain Incrementals30 daysHow long to keep incrementals.
Retain PITR72 hoursHow long to keep transaction log archives.

Encryption

FieldWhat it means
Encryption EnabledTurn on AES-256 encryption before upload (default on).
info

With encryption on, the system generates and stores an encryption key for you. All backups uploaded under this policy are encrypted client-side before they leave the database.

Click Create to save.


User: Creating a Backup Policy

End users see the same form (minus the user picker) at Databases then Backup Policies in their sidebar. They follow steps 1 through 4 the same way.


Policy Detail Page

Policy Summary

  • Name and status (Active, Paused, Error, or Validating).
  • S3 endpoint, bucket, region, and path prefix.
  • Last successful S3 credential check time.
  • Schedule (frequency, time, day for weekly, incremental frequency).
  • Retention values.
  • Encryption on/off.
  • Consecutive failure count, if any have happened.

Attached Databases

Table of databases attached to this policy.

ColumnWhat it shows
Database NameManaged database name.
EngineMySQL, MariaDB, or PostgreSQL.
HostDatabase hostname.
Last Full BackupTimestamp of the last full backup.
Last IncrementalTimestamp of the last incremental.
PITR StatusActive, Configuring, Error, or - if disabled.
ActionsDetach button.

Attaching Databases

A database can be attached to exactly one backup policy at a time. Only primary databases in Active status are eligible.

From the Policy Detail Page

  1. Open the policy.
  2. In Attached Databases, pick a database from the dropdown.
  3. Click Attach.

What happens on attach

  1. Backup tools installed - The right utility for the engine is installed on the database server.
  2. PITR configured - If the policy has PITR enabled, transaction log archiving is set up on the database.
  3. Initial full backup - An immediate full backup runs to give the policy a baseline.
info

Attach can take a few minutes, especially when PITR has to be configured and the first full backup is large.

Detaching a Database

Click Detach next to the database on the policy detail page. PITR is turned off on detach. Existing backups already in the bucket are not deleted.


Backup Types

Full backups

A complete copy of the database. The baseline for incremental chains and PITR.

Incremental backups

Only the changes since the last full backup. Much smaller and faster. If the parent full backup is missing (retention cleaned it up, for example), the system falls back to a full backup automatically.

PITR archives

The continuous stream of transaction logs:

  • MySQL / MariaDB: binary logs uploaded during each incremental backup job.
  • PostgreSQL: WAL segments uploaded continuously as they are generated.

Backup Source Selection

The system picks the safest source automatically:

  1. If a healthy replica is available, the backup runs on the replica so the primary is not loaded.
  2. If no healthy replica is available, the backup runs on the primary.
tip

This is automatic. Set up a replica and your backups will use it without any extra config.


Scheduling

  • Full backups run at the configured time and frequency.
  • Incremental backups run at the configured interval between fulls.
  • If a database already has a pending or running backup, the next slot is skipped to avoid overlap.

Retention and Cleanup

Retention runs daily.

RuleWhat it does
Full backup countKeeps the newest N full backups, deletes the rest.
Incremental ageDeletes incrementals older than the retention period.
PITR archive ageDeletes PITR archives older than the retention period.
Orphaned incrementalsDeletes incrementals whose parent full backup no longer exists.
warning

When a full backup is deleted, every incremental in its chain and every PITR archive that depends on it is also deleted.


Restore Operations

Restore from a backup

Restore the database from a specific full or incremental backup.

  1. Open the database detail page, go to the Backups tab.
  2. Click Restore next to the backup.
  3. Confirm.

For an incremental restore, the system applies the parent full backup first, then walks the incrementals.

Point-in-Time Recovery (PITR)

Restore to a specific second within the PITR window.

  1. Open the database detail page, click Restore PITR.
  2. Pick the target date and time (the available window is shown).
  3. Click Restore.

The system finds the newest full backup before the target time, applies the incrementals, then replays the transaction logs up to your exact timestamp.

danger

Restore overwrites the current database. The operation cannot be undone. Take a manual backup first if you might want to roll back the restore.


Manual Backup

Trigger an immediate full backup from the policy detail page or the database manage page with Manual Backup. The request is rejected if another backup is already pending or running.


Failure Handling

EventWhat happens
Single backup failureMarked failed, failure counter incremented, email sent.
3 consecutive failuresPolicy paused, new backups stop scheduling, email sent.
Backup succeedsCounter resets, paused policies become Active again.
PITR gap detectedPITR status set to Error, email sent.
Backup source unavailableNext backup picks a different source, email sent.

The policy detail page shows a warning banner when failures have occurred, with the counter and the last error. A Reset Failures button clears the counter and brings the policy back to Active.


Email Notifications

NotificationTrigger
Backup FailedEach individual backup failure.
Policy Paused3 consecutive failures.
PITR Gap DetectedTransaction log continuity broken.
Backup Source ChangedSource switched between replica and primary.

Admin vs. User Capabilities

CapabilityAdminUser
Create policiesAny userOwn only
Edit / delete policiesAnyOwn only
Attach / detach databasesAnyOwn only
View all policiesYesOwn only
Delete individual backupsYesOwn only
Reset failure counterYesOwn only
Trigger manual backupYesOwn only
Restore from backupYesOwn only
PITR restoreYesOwn only

Troubleshooting

Policy stuck in "Error" status

The policy auto-pauses after 3 consecutive failures.

  1. Read the error on the policy detail page.
  2. Click Test Connection to confirm the S3 credentials still work.
  3. Confirm the database is running and reachable.
  4. Click Reset Failures to resume the policy.

Backup fails with "S3 upload failed"

  1. Check that the access key has not been rotated or revoked.
  2. Confirm the bucket exists and the key has the required permissions.
  3. For non-AWS endpoints (RustFS, etc.), confirm the endpoint URL and HTTPS work.

PITR status shows "Error"

Means the transaction log continuity is broken. Use Retry PITR Configuration on the database detail page to redeploy PITR.

Incremental fell back to full

The parent full backup was either deleted by retention or had incomplete metadata. The system runs a fresh full backup so the chain is consistent.

Restore fails

  1. Check the task status on the admin dashboard for the error.
  2. Confirm the database server has enough disk space for temporary restore files.
  3. PITR restores can take a while if many transaction log segments need to be replayed.

"Database is already attached to another backup policy"

A database can only be attached to one policy at a time. Detach from the current policy first.