Gapless

Backups and Recovery

What must be backed up in an AI assistant, what can be rebuilt instead, recovery targets for each store, and how to test that recovery actually works.

Not every store needs a backup. Some can be rebuilt from other data. The question for each store is: if it disappeared, how would you get it back, and how long would that take?

Back up or rebuild

StoreStrategyWhy
App database (conversations, settings, users, audit)Back up with point-in-time recoveryCannot be rebuilt. It is the system's own data
Object storage (uploads, raw source copies)Replicate and version, with deletion rulesUploads cannot be rebuilt. Source copies can be re-fetched but slowly
Search indexRebuild from raw copies, plus snapshots for speedDerived data, but rebuilding a large index takes hours to days
Redis (limits, caches, stream buffers)Neither. Accept lossEverything here is temporary
Traces and logsPlatform's own durability. No special backupShort-lived operational data
Audit eventsBack up, append-only, separate accountCompliance requires integrity and availability
Configuration, prompts, model routesIn gitAlready versioned
SecretsSecret manager with its own backup and recoveryLosing them blocks recovery of everything else

Recovery targets

Two numbers define each target:

  • RPO (recovery point objective): how much data, measured in time, you can afford to lose.
  • RTO (recovery time objective): how long you can afford to be down.
StoreRPORTOHow
App database5 minutes1 hourManaged Postgres with continuous WAL archiving and point-in-time restore. Cross-region replica for regional failure
Uploads0 (replicated)1 hourCross-region replication of the bucket
Search index24 hours4 hoursDaily snapshot restore, then incremental re-sync from connectors for changes since the snapshot
Search index, full rebuildn/a1 to 3 daysRe-run ingestion from raw copies. Embedding API limits decide the duration
Audit events024 hoursWrite-once storage replicated to a separate account

These are examples. Set your own with the business, and remember that tighter targets cost more.

Why the index needs snapshots

Rebuilding the index from raw copies works, but at scale it is slow and expensive: millions of chunks to re-embed, at embedding API rate limits. A daily snapshot lets you restore in hours, then catch up with incremental syncs. Keep snapshots in the same region as the index for fast restore, plus at least one copy in another region.

When restoring a snapshot, re-apply deletions and permission changes that happened after the snapshot before serving traffic. Otherwise the restored index serves deleted documents and revoked access. Connector reconciliation can do this, but it must run before the index goes live, not after.

What a restore looks like

Degraded mode means the assistant keeps working without retrieval, clearly telling users it cannot search documents right now, or answering only from user uploads. Decide this behavior in advance. An assistant that silently answers company questions without sources during an index outage will hallucinate company facts.

Encryption and access

  • Backups are encrypted with keys managed in your key management service.
  • Backup storage is in a separate account or project with restricted access. An attacker who compromises production should not be able to delete backups.
  • Enable deletion protection or object lock for backups and audit logs.
  • Access to restore is limited, logged, and requires approval.

Testing recovery

A backup that has never been restored is a hope, not a backup.

TestFrequency
Restore the app database to a point in time in a non-production environment, and run integrity checksMonthly
Restore the search index from snapshot, replay deletions, and run retrieval evaluationQuarterly
Full regional failover drillYearly, or per contract
Rebuild the index from raw copies for one tenant and measure the durationYearly, and after major corpus growth

Record the measured time for each test. If the measured recovery time exceeds the RTO, either improve the process or change the target honestly.

See Disaster recovery for regional failover and the broader recovery plan.

Checklist

  • The app database has point-in-time recovery and a cross-region replica.
  • Uploads are replicated, and versioning works with deletion rules.
  • The search index has daily snapshots, and a full rebuild procedure is documented.
  • Restores replay deletions and permission changes before serving traffic.
  • Degraded mode is defined for when retrieval is unavailable.
  • Backups are encrypted, in a separate account, with deletion protection.
  • Restore tests run on a schedule, and recovery times are measured.

On this page