If you haven’t done so, install Vagrant for your OS here.

vagrant plugin install vagrant-digitalocean
mkdir vagrant_project
cd vagrant_project
vagrant init

Generate your key pairs. If using Windows, use puttygen. In Windows you’re going to have to use the OpenSSH key formats:

digitalocean-puttygen-private-key digitalocean-puttygen-public-key

ssh-keygen -t rsa

Edit VagrantFile. Make sure the private key does not have an extension. The public key should have extension “.pub” with the same file name as the private key (e.g., “do.pub”).

Create your API V2 token from your DO control panel:


Vagrant.configure('2') do |config|
	  config.vm.provider :digital_ocean do |provider, override|

    # Windows
		    override.ssh.private_key_path = "C:\\path\\of\\private\\key\\do"
    # Linux 
    override.ssh.private_key_path = "~/.ssh/id_rsa"

		    override.vm.box = 'digital_ocean'
		    override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
    		provider.token = 'YOUR DIGITALOCEAN TOKEN'
		    provider.image = 'ubuntu-14-04-x64'
		    provider.region = 'sfo1'
		    provider.size = '512mb'

Most of these lines are self-explanatory. To get a list of images and regions you could click on “Create Droplet” from your web account or you could run the following:

curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer YOUR_DIGITALOCEAN_TOKEN' "https://api.digitalocean.com/v2/images?page=1&per_page=100"

Here’s a sample list of regions and images:

Regions Images
  • nyc1
  • ams1
  • sfo1
  • nyc2
  • ams2
  • sgp1
  • lon1
  • nyc3
  • ams3
  • fra1″
  • centos-5-8-x64
  • debian-6-0-x64
  • fedora-21-x64
  • ubuntu-12-04-x64
  • debian-7-0-x64
  • ruby-on-rails
  • wordpress

Now just change into the Vagrant project folder and run “vagrant up”