A more customizable alternative to Vultr's backup feature using Vultr API v1. Tested on Ubuntu 16.04. Run this php script on a Vultr instance to create a snapshot of itself and rotate out the oldest snapshot(s). Use the $backup_tag
field to uniquely id a set of snapshots.
- Set
$api_key
to your Vultr API key. - Set
$num_of_backups
to specify how many snapshots to keep. - Set
chmod +x vultr-snapshot.php
. - Add
vultr-snapshot.php
to your cron tab. - Epic winning at life.
For example, add the crob jobs below in order to create 3 daily, weekly, and monthly snapshots. The oldest snapshots will be automatically rotated out.
0 0 * * * /home/user/scripts/vultr-snapshot.php
Using the metadata API would be a better choice for getting the SUBID: https://www.vultr.com/metadata/