Skip to content

Instantly share code, notes, and snippets.

@codfather
Created April 21, 2015 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codfather/a2aa57f57262797462f9 to your computer and use it in GitHub Desktop.
Save codfather/a2aa57f57262797462f9 to your computer and use it in GitHub Desktop.
Digital Ocean create droplet using ssh keys
#!/Users/nickhadd/.rvm/rubies/ruby-2.1.0/bin/ruby
# This script allows us to create new droplets
require 'droplet_kit'
print "Enter you new droplet name ->: "
dropname = gets.chomp
token=ENV['Oauth_key']
client = DropletKit::Client.new(access_token: token)
# The last part of the object created below is the ssh_key ID array, very important to access the VM ;-)
droplet = DropletKit::Droplet.new(name: dropname, region: 'lon1', size: '512mb', image: 'ubuntu-14-04-x64',ssh_keys: [123456])
client.droplets.create(droplet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment