How can I dump and restore my Aptible database?
If you want to migrate data from one Aptible database to another, or perform a backup and restore, you can use the Aptible CLI with the following steps:
Tunnel to the origin database:
aptible db:tunnel $ORIGIN_DB_HANDLE
Launch a database client and use the relevant appropriate command to dump your data locally, e.g.
mysqldump -u aptible -p[PASSWORD] -h 127.0.0.1 -P [PORT] db > dumpfilename.sql
If you’re using PostgreSQL, you can combine steps 1 and 2 with
aptible db:dump $HANDLE
Provision a new Aptible database if you have not already done so.
Similar to the first two steps, connect to the new database and, in a new bash session, upload the dumped file:
1 2 3 4
aptible db:tunnel $NEW_DB_HANDLE # separate session mysql -u aptible -p[PASSWORD] -h 127.0.0.1 -P [PORT] db < dumpfilename.sql