Vultr: Auto backup your servers with free Snapshots Dec 6, 2018


It is crucial to have an auto backup system for all your servers, and Vultr does offer this, but it is not free. In this article, I will show you how to build a script to do the backup job automatically with 2 backups stored.



  • Any Vultr Linux base server. If you do not have one, signup and get free $25 here.
  • Basic knowledge of SSH

Step 1: Get Vultr API key

Login to your Vultr's account, go to Account \ API and get your Personal Access Token.

Step 2: Create a script for auto taking snapshots

SSH to your server, add 2 file name and SNAPSHOTID, put them in /root


# info

cd /root

# count
COUNT=$(awk 'END {print NR}' SNAPSHOTID)

# list old snapshots

# delete
if [ $COUNT -ge 2 ]; then
# get the 1st to delete

# delete old snapshot
curl -H 'API-Key: '$API --data 'SNAPSHOTID='$DELID

# update SNAPSHOTID file
sed -i '1d' SNAPSHOTID

# create new snapshot
curl -H 'API-Key: '$API --data 'SUBID='$SUBID --data 'description='$DESC | grep -Po '"SNAPSHOTID": *"\K\w+' >> SNAPSHOTID

Replace API with your token got from step 1, SUBID with your Vultr server ID (you can get your server ID by looking at the URL when you are viewing your server) and DESC with any text would help you easily identify the snapshot for the server.

Step 3: config crontab to run the script daily

Run crontab -e and add the following line (I assume your OS is Ubuntu)

0 2 * * * /root/ > /dev/null 2>&1

Congratulations, now you have an auto backup system for your Vultr's Server(s)!



Latest Updates