Thanks to Automated Snapshots / Backups via Vultr API And this is Python3 version script used to Automatic snapshots using Vultr API
A more customizable alternative to Vultr's backup feature using Vultr API v1. Tested on Ubuntu 16.04. Run this python3
script on Anywhere to create a snapshot of VPS (which you know IP or it's subid) and rotate out the oldest snapshot(s). Use the BACKUP_TAG_PREFIX
prefix field to uniquely id a set of snapshots.
Notice: You can only create 11 snapshots by default.
- Set
API_KEY
to your Vultr API key. - Set
MAX_NUM_OF_BACKUPS
to specify how many snapshots to keep. - Test it and then add
vultr_auto_snapshot.py
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 * * * /usr/bin/python3 /home/user/scripts/vultr_auto_snapshot.py