# Upgrades and backups

> Upgrading the engine, what is backed up and how to restore.

Applies to: the Sypnia engine (open source, self-hosted).  
Source: https://run.docs.sypnia.com/self-hosting/upgrades/

For agents: Run upgrades: run engine upgrade [--to] updates stack and runs DB migrations before switching functions; apps not redeployed (engine upgrade --apps when needed). Backups: state in RDS automated backups (7 days), artifacts with S3 versioning, secrets exported with env pull --include-secrets, app data not in Run; restore RDS snapshot and engine reconciles with tagged AWS resources.

## Upgrades

```bash
npx @sypnia/run engine upgrade             # to the latest version
npx @sypnia/run engine upgrade --to 0.4.0
```

An upgrade updates the engine's stack and runs the database migrations of the new version before switching the functions. Apps are not redeployed; their resources keep running. Each release note says whether an upgrade changes app stacks (then `engine upgrade --apps` updates them one by one).

## Backups

| What                      | Where           | Backed up by                                               |
| ------------------------- | --------------- | ---------------------------------------------------------- |
| The engine's state        | Postgres        | RDS automated backups (7 days by default)                  |
| Artifacts of kept deploys | S3              | versioning on the bucket                                   |
| Secrets                   | Parameter Store | export with `run env pull --include-secrets` to your vault |
| Your apps' data           | not in Run      | your database and storage                                  |

To restore after losing the database, restore the RDS snapshot; the engine reconciles its records with the AWS resources it finds by tag.
