Multi-threading. Auto-cleanup. Cron optimized.
There are a lot of neat tools people have built for DigitalOcean.
The app I’m really in love with is DOSnapshot, and is hosted on GitHub. DOSnapshot does exactly what its name would suggest, it takes snapshots of your droplets.
As of this post, I’m the only one that’s left a comment on the DOSnapshot Community Projects page, which took me a bit by surprise, given the quality of the tool.
Taking a snapshot of a DigitalOcean Droplet is essentially like making an exact copy of the Droplet (server) that you can then use again at a later time. Very useful for scaling and updating a Droplet to a newer version of your Linux distribution without losing all of the Droplet’s configuration.
Etel Sverdlov does a very good job of explaining the difference between snapshots and backups in this DigitalOcean community tutorial. I suggest you read it if you’re unsure what the differences between a backup and snapshot are.
1. Install DOSnapshot
DOSnapshot can be installed as a ruby gem, which is what I chose to do because it’s just so easy. Don’t install this on your DigitalOcean Droplet! It’s meant to run from your local machine. Installing DOSnapshot as a Rubygem is as simple as:
sudo gem install do_snapshot
Pre-built binaries are also provided for Linux users, and OSX users have the option of installing via Homebrew Tap.
2. Set Your DigitalOcean Client ID and API Key
Once you’ve got it installed, you’ll need to set your DigitalOcean Client ID and API Key. You can set them as environment variables, or you can pass them as parameters when actually running DOSnapshot. This is straight from the README:
First you may need to set DigitalOcean API keys:
$ export DIGITAL_OCEAN_CLIENT_ID=”SOMEID”
$ export DIGITAL_OCEAN_API_KEY=”SOMEKEY”If you want to set keys without environment, than set it via options when you run do_snapshot:
$ do_snapshot –digital-ocean-client-id YOURLONGAPICLIENTID –digital-ocean-api-key YOURLONGAPIKEY
3. Take A Snapshot
Please remember that running the do_snapshot
command will cause your droplet to shutdown so the snapshot can be taken.
DOSnapshot has a pretty large number of options that you can specify. I’m going to keep this simple so you get the basics of it. Learning a few of the main options will be mostly what you need to know, after you’ve got them figured out, setting up a cronjob is cake.
You can take snapshots of all of your droplets at once, you can specify which droplets to take snapshots of, and you can specify droplets that you don’t want to take a snapshot of. I typically take a snapshot of a single droplet at a time, and I do it like this:
do_snapshot --only 1111 -k 3 -c -v
The above will take a snapshot of only one droplet, a droplet with an ID of 1111, replace 1111 with the ID of your droplet. You can find your droplets ID in your browser URL bar while managing the droplet. So if you see https://cloud.digitalocean.com/droplets/1234567, your droplet’s ID is 1234567.
Here’s all of the options.
4. Scheduling With Cron
First, you must have cron installed. There’s plenty of tutorials on how to do that. That tutorial even explains how to configure a cron job using the crontab utility. There’s an example crontab entry in the DOSnapshot README. Mine is pretty simple:
0 4 * * 2 do_snapshot --only 1111 -k 3 -c -v
If you have questions about setting any of this up, feel free to leave a comment!
Well, now what?
Work with Me
I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!
Leave some Feedback
Got a question or some updated information releavant to this post? Please, leave a comment! The comments are a great way to get help, I read them all and reply to nearly every comment. Let's talk. 😀
Longren.io is proudly hosted by DigitalOcean

Tyler, Hello! Thanks for nice review! I’m added link into readme,.
It’a an awesome tool man! Thanks for developing it. 🙂
Thanks for this. I am able to create snapshots from my local machine, but confused on how to set up cron. I assumed server-side cron? If so, did you have to install a ruby script on the server to fire with cron? I’m thinking this must be either local cron or a cron on another server. UPDATE: Just fired it with cron from local machine no problem. I still might use a server script and cron job so my machine doesn’t have to be on.
Cron on the server side won’t work well, as you’d need to install do_snapshot on the server. And when you take a snapshot of a droplet, it’s shutdown so the snapshot can be taken.
I always have my main workstation on, so it’s not really a problem for me, but I can see where folks who only have laptops (especially) that aren’t always on would run into issues.
Maybe installing do_snapshot on a small, $5 droplet would work for you. It’d essentially act as a dedicated do_snapshot droplet. You’d always leave that droplet on, so cron would always be running on it, firing do_snapshot when requested, backing up the droplets you’ve specified.
Just tossing ideas out. 🙂
Thanks. I was thinking about the same option (cf. https://www.digitalocean.com/community/tutorials/how-to-use-digitalocean-snapshots-to-automatically-backup-your-droplets). For now I’ll stick to the local machine.
Hello Joshua,
DOSnapshot can be installed as ‘executable’ script, so you can run it as any script.
As Tyler suggest you can install it on another instance.
1 Note: Run commands from another droplet or VPS, something like main server :))) Or yes, you will off your droplet.
Process is:
Off your droplet
Make snapshot
Check status after snapshot is created or log, mail errors.
As i see, there is no difference which cron you use. on OSX we have anacron., on Debian/RHEL and so on we have similar tools. Just setup diff 🙂
Requirements only: Ruby 1.9.3, 2.0.0, 2.2.0 and so on ;), or JRuby on your server.
Here you can find standalone releases:
https://github.com/merqlove/do_snapshot/releases
For example you can unpack it into /usr/local/lib/do_snapshot-0.0.13 and place link for ‘/usr/local/lib/do_snapshot-0.0.13/bin/do_snapshot’ into /usr/local/bin, which must be in server PATH variable.
Thanks! Program works like a charm.
Is there any way I can make a local backup of the snapshot?