Docs / Hosted backups and drills

Hosted backups and drills

If your database runs on Supabase, Neon or RDS and you have no server beside it, SafeGrd can back it up for you. If a surface has no host to drill it, for example one you back up from a GitHub Actions workflow, SafeGrd can drill it too.

For each job, SafeGrd starts a machine, gives it the one secret that job needs, and destroys the machine when the job ends.

Backup

  1. Your database read with a read-only role
  2. A machine for this backup dumps, compresses, encrypts
  3. Hosted storage locked under Object Lock
Given
the connection string, for this backup only
Never given
the key that decrypts backups

Fire Drill

  1. Hosted storage the newest snapshot
  2. A machine for this drill restores into a throwaway database
  3. A signed record every table counted
Given
the key, for the one snapshot it restores
Never given
the connection string
Both machines are destroyed when their job ends. The backup goes from the database to storage and from storage to the drill, and never through SafeGrd's server.
A PostgreSQL database added with Back up on SafeGrd. The first backup runs as soon as it is added, and the drill that follows restores 4 tables and 454,040 rows.

Back up a database with nothing to install

  1. Under Surfaces, choose Add surface, then Back up on SafeGrd.
  2. Name it, and pick what it is: PostgreSQL, MySQL or MariaDB, MongoDB, or a bucket.
  3. Paste the connection string. Test connection opens it from SafeGrd's server and says what failed when it cannot.
  4. Pick how often to back up and how long to keep each backup, then Add and back up now.

The first backup starts within a few minutes. If the password is wrong, you find out then instead of the next morning. The first drill runs on your plan's schedule.

The database has to accept connections from the internet. A read-only role is enough. If your database only accepts listed IP addresses, the console shows SafeGrd's addresses beside Back up on SafeGrd (when SafeGrd's machines connect from fixed ones).

Supabase

Click Sign in to Supabase and pick your project from the list. The session pooler's address is filled in for you. From then on, each backup signs in through Supabase with a read-only role whose password expires within minutes. You can type the project's database password instead, if you have it (Supabase does not show it again).

To skip the sign-in, copy the Session pooler string (port 5432) from Connect in Supabase's dashboard and add ?sslmode=require. The transaction pooler on port 6543 cannot take a backup.

A project's Storage files are a second surface. You can add them two ways:

Each bucket is backed up as one archive of its objects and drilled on its own (details). Both surfaces appear together under Supabase project in the surfaces list, each with its own Fire Drills and certificate. To restore, bring back the database rows first, then run safegrd restore --target s3://* with the project's S3 key. Each file goes back to the bucket it came from.

Each backup uploads what changed

A PostgreSQL backup reads every table and uploads only the rows that changed since the last one.

What it costs at your provider

Every backup reads the whole database, and your provider may bill that as egress. Before you add the surface, click Price this schedule in the form. It measures the database and prices the schedule at its provider. From a terminal, safegrd estimate does the same.

Drill a surface on SafeGrd

Turn on Drill on SafeGrd in a surface's panel. Each time a drill is due, SafeGrd starts a machine, restores the newest snapshot, checks it the same way a host would, signs the record and destroys the machine. The Fire Drills tab marks these drills as run on SafeGrd. Surfaces that SafeGrd backs up are drilled this way from the start.

The surface's backups have to be in hosted storage, with a SafeGrd-managed key, because the machine needs to decrypt the snapshot. If the option is missing, the surface's panel tells you why.

PostgreSQL, MySQL, MariaDB, MongoDB and SQLite snapshots are restored into a throwaway database of the same engine. Files and mailboxes are read back in memory. If a PostgreSQL snapshot needs an extension the plain image does not have, such as pgvector or a Supabase extension, the drill runs on Supabase's own image, which has them.

Drill checks you wrote as queries run on SafeGrd's machine too. Checks written as commands run only on your own host.

A run on SafeGrd outside the schedule

On a surface's Details, Back up now on SafeGrd and Drill now on SafeGrd start a machine straight away, even for a surface a host normally runs. Use them when the host is down, or when an audit is coming and the plan's next drill is days away. Agents can do the same with the MCP tools request_backup and request_drill and on: safegrd.

What you need

The host needs a SafeGrd-managed key. A drill also needs the newest backup to be in hosted storage. A backup needs SafeGrd to hold the surface's connection string (Credential on the surface) and the project to use hosted storage. The backup is sealed to the host's key, so the host can restore it. If something is missing, the button says what.

What it costs

Each plan includes a number of these runs per rolling 30 days (see the table below). Backups and drills share the count across the whole organization.

Once you have used them all, the button tells you when the oldest run drops out of the 30 days.

What it records

A drill started this way is a normal Fire Drill. It is signed into the record and shown on the certificate, and the next scheduled drill is due one interval after it. A backup appears under the same surface as the host's own backups. On an incremental surface, that run uploads the whole database, because the machine does not have the host's cached state.

Which machine gets which secret

Each machine gets only the secrets its job needs, for that one surface, and only while the job runs.

JobGivenNever given
BackupThe connection string or bucket key, and the public key it encrypts to.The key that decrypts backups.
Fire DrillThe key for the snapshot it restores.The connection string.

SafeGrd writes each release to the Key access record before it happens, with the job and the time. You can read it under Projects, Storage. For what SafeGrd can hold and the two ways your key can be managed, see Security and key custody.

Minutes on SafeGrd

Each plan includes machine time per rolling 30 days, and a size limit for snapshots drilled in a sandbox:

PlanRuns on SafeGrdLargest snapshotAt onceOn-demand runsSurfaces SafeGrd backs up
Free20 minutes a monthIn memory, within the plan’s storage1NoneNone
Starter800 minutes a month5 GB110 runs a month3
Growth2,500 minutes a month8 GB230 runs a month10
Scale8,000 minutes a month25 GB4100 runs a month30

A job counts the time its machine ran, from when SafeGrd asked for the machine until the job ended. If the job moved a lot of data, it counts 10 minutes per GB instead, whichever is more. For example, a drill of a 2 GB snapshot that runs for 6 minutes counts 20 minutes. A backup of a 300 MB database that runs for 3 minutes counts 3. Fractions of a minute count, and there is no minimum.