# Self-hosted to Cloud

Step-by-step guide to migrate your data from self-hosted Core to a Blnk Cloud deployment, or export a Cloud deployment back to Postgres.

Move ledger data from a self-hosted Core database into a Blnk Cloud deployment, or export a Cloud deployment back to Postgres you operate. Cloud adds automated backups, IP whitelisting, and the hosted Core runtime.

You can run the migration in either direction:

- **Import into deployment:** bring data from an external PostgreSQL database into Blnk Cloud
- **Export from deployment:** send data from Blnk Cloud to an external PostgreSQL database

## Before you start

You need both of these online before the migration can run:

- An active deployment on Blnk Cloud. If you don't have one yet, see [Managed instances](/cloud/instances/deploy).
- The full connection URL of your external or self-hosted Postgres database, for example `postgresql://user:pass@host:5432/dbname?sslmode=require`.

## Run a migration

<Steps>
<Step title="Open Migration">

Go to **Settings → Migration**. Select the deployment, choose a direction, and paste the PostgreSQL URL.

- **Deployment:** the Cloud deployment to import into or export from
- **Direction:** Import into deployment, or Export from deployment
- **PostgreSQL URL:** the connection string for the external database

<Frame caption="Go to Settings, then Migration, select a deployment and direction, paste your PostgreSQL URL, then start the migration">
![Migration page showing the Data Migration form and Migration history table](img/migrations/migration-page.gif)
</Frame>

</Step>

<Step title="Start the migration">

Click **Start migration** and confirm. Avoid making changes to your data during the migration, so the two databases do not diverge while the copy is running.

After you confirm, Blnk runs the migration asynchronously and updates **Migration history** as it progresses (for example, `pending`, then `running`, then `succeeded` or `failed`).

</Step>
</Steps>

## After the migration

On your Cloud workspace:

1. Confirm that ledgers, balances, transactions, and identities look correct in the dashboard or your usual tools.
2. Compare record counts or spot-check key data against the source database.
3. Test your workflows on the new deployment before you switch production traffic to it.

<RelatedTopics
  items={[
    { title: "Managed instances", href: "/cloud/instances/deploy" },
    { title: "Self-hosted instances", href: "/cloud/instances/create" },
  ]}
/>