How do I delete data from a Backup?

We have a requirement to delete specific data from the historic database backups, how can we do this in Aptible?

Database backups on Aptible Deploy are taken as incremental volume snapshots, not a logical data dump. This means you cannot edit or delete data within the backup itself. You can however purge any backups if you need to dispose of the data they contain.

If you do not need to retain the rest of the dataset:

You can use the command aptible backup:list $DB_HANDLE --max-age 10y to list all backups for a database ( 10y means 10 years) and use the date/time of the backup to determine if you need to purge it. You can then use aptible backup:purge $BACKUP_ID to permanently remove any backup you need delete.

If you need to retain the rest of the dataset:

Because database backups are taken as encrypted incremental volume snapshots, there is unfortunately not a simple way to target specific data to be removed from a backup. For each and every backup, you would need to:

  1. Restore the backup as a new database
  2. Delete the pertinent data from the new database
  3. Make a backup of the edited database
  4. Deprovision the edited database
  5. Purge the original backup

If you need to delete specific data frequently, we recommend you to perform a similar process but create a logical backup (e.g. pg_dump or mysqldump ) that you maintain outside of Aptible. This way you can edit data freely for future data deletion requests.