Finding the database app instance
If you set up your application usingfly launch, the name of your database app might be <app-name>-db, or you might have given it a name during the initial configuration. To find the name of your Postgres app, run:
NAME column. In this example, my-app-db is the value to use for <postgres-app-name> in the following commands.
Listing snapshots
Fly.io performs daily storage-based snapshots of each of your provisioned volumes. These snapshots can be used to restore your dataset into a new Postgres application. Snapshots are volume specific, so you need to identify the volume whose snapshot you want to restore from. You can list your volumes by running thevolumes list command with your Postgres app name.
ID columns are what will be used to restore a snapshot.
Identifying your Postgres image version
Depending on when you created your Postgres cluster, it may be running an older image than the default for newly created clusters. Different Postgres major versions may not be fully compatible, so it’s important to use the same version for your restored cluster. To see your Postgres image and version, runfly image show.
REPOSITORY and TAG columns reference the image you’ll use to restore the snapshot.
Legacy postgres images use the flyio/postgres repository, while new Postgres Flex images use the flyio/postgres-flex repository. Join the two values with a colon to form the image reference: in the above example, the machine is running a legacy flyio/postgres:14.6 image.
Restoring from a snapshot
To restore a Postgres application from a snapshot, simply specify the--snapshot-id argument and the --image-ref argument when running the create command as shown below:
Important: The size of the volume provisioned for the new Fly Postgres application must be equal to or greater than the volume from where the snapshot was taken.