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

# Backup & Restore

> Backing up and restoring your Omni instance

## Overview

All Omni data is stored in PostgreSQL. Backing up your database ensures you can recover:

* User accounts and settings
* Connector configurations
* Indexed documents and search index
* Chat history

## Backup

### Docker Compose

If you haven't already, set up the alias:

```bash theme={null}
alias omni-compose="docker compose -f docker/docker-compose.yml --env-file .env"
```

```bash theme={null}
omni-compose exec postgres pg_dump -U omni omni | gzip > backup_$(date +%Y%m%d).sql.gz
```

### AWS (Terraform)

Postgres runs as an ECS task. Use ECS Exec to run the backup:

```bash theme={null}
aws ecs execute-command --cluster omni --task <postgres-task-id> \
  --container postgres --interactive \
  --command "pg_dump -U omni omni" | gzip > backup_$(date +%Y%m%d).sql.gz
```

## Restore

### Docker Compose

```bash theme={null}
gunzip < backup.sql.gz | omni-compose exec -T postgres psql -U omni omni
```

### AWS (Terraform)

```bash theme={null}
gunzip < backup.sql.gz | aws ecs execute-command --cluster omni --task <postgres-task-id> \
  --container postgres --interactive \
  --command "psql -U omni omni"
```

<Warning>
  Restoring will overwrite existing data. Stop all Omni services before restoring.
</Warning>

## Recommendations

* **Daily backups** for production instances
* **Test restores** periodically to verify backup integrity
* **Store backups offsite** or in a different region than your primary deployment
