---
title: "Backups and restore"
description: "Automated backups with point-in-time restore, manual and final backups that outlive their database, and restores into a new database."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Backups and restore

Every database is backed up continuously, with nothing to set up. A database can be restored to any
second in its **restorable ranges**, into a new database. Backups are encrypted, and you reach them
only through the API, the CLI and the console.

## Automated backups

A backup is taken every day inside the database's **backup window**, and the database's changes are
saved continuously between backups.

| Setting | |
| --- | --- |
| `backup.retentionDays` | How long automated backups are kept, 1 to 35 days. 7 by default. |
| `backup.windowUtc` | When the daily backup is taken, `HH:MM-HH:MM` in UTC, at least 30 minutes. Each database gets a default window. |

```sh
ezgh databases update dbi_4k2m9x0a7qpe --backup-retention-days 14 --backup-window 03:00-04:00
```

Automated backups expire with the retention period, and can't be deleted: a delete is refused with
`409 backup_automated`. They go with their database when it's deleted.

## Restorable ranges

A database's `restorableRanges` (`ezgh databases get`, and the **Backups** tab in the console) are
the times it can be restored to, each `{ "from", "to" }`. The latest restorable time trails the
present by a few minutes.

## Manual and final backups

```sh
ezgh databases backups create dbi_4k2m9x0a7qpe --wait
```

A manual backup is kept until you delete it, after its database too. Deleting a database takes a
final backup first unless you ask it not to, kept the same way. `ezgh databases backups list` lists
them, including those of deleted databases; `--database` narrows the list to one.

A manual backup can't be deleted while it's being created: that's `409 backup_not_available`.

## Restore

A restore makes a **new database**, in any subnet of the project, from either:

- a backup, `source: { "backup": "dbb_…" }`:

  ```sh
  ezgh databases restore orders-copy --from-backup dbb_7t3n1v8c2wzd \
    --instance-type gp-1.large --subnet sbn_2m9x0a7qpe4k --storage-size-gib 100 --wait
  ```

- a database as it was at a time in its restorable ranges, in whole seconds, `source: { "database": "dbi_…", "time": "…" }`:

  ```sh
  ezgh databases restore orders-copy --from-database dbi_4k2m9x0a7qpe --time 2026-11-02T09:30:00Z \
    --instance-type gp-1.large --subnet sbn_2m9x0a7qpe4k --storage-size-gib 100 --wait
  ```

In the API, it's [CreateDatabase](/databases-api/CreateDatabase/) with `source`. The source
decides the engine and version, and the storage must be at least the source's. The new database has
its own endpoint and its own admin Secret. Restoring needs `databases.backups.get` on the source.

| Refusal | Means |
| --- | --- |
| `409 time_not_restorable` | The time is outside every restorable range. The error carries the database's `restorableRanges`. |
| `409 backup_not_available` | The backup isn't available, or a backup it builds on is gone. |

A deleted database can't be restored to a time; restore one of its manual or final backups instead.

Source: https://docs.ezghcloud.com/databases/backups-and-restore/index.mdx
