Using libcloud with RimuHosting has merged our RimuHosting driver into their Python library.  All of our api functionality isn’t included in that driver, but there are a number of handy things that you can do via just a smattering of python code.  I’m going to write a few articles on this topic to demonstrate some of the cool things that you may find useful (dynamically adding webheads to handle an increasing load when you need it).  :)

Let’s dive in and get our feet wet first and see how to make this thing go.   I’m working from a Debian 5 box here so there may be some differences in the setup bits, but the python code itself would be identical.

The library is dependent on a couple things that aren’t installed by default.  You’ll need the zope3 package and the simplejson python package (unless you’re on python 2.6 already):

apt-get install zope3
tar xfz simplejson-2.0.9.tar.gz
cd simplejson-2.0.9
python install

Then you can install the libcloud driver and then we’re ready to get cracking:

git clone git://
cd libcloud
python install

You’re going to need to fetch your RimuHosting api key.  You can get that here:

All of the hard stuff is done; the rest is quite simple.  Here is a working example (provided you have a valid api key) to list all of your running nodes:

from libcloud.drivers.rimuhosting import RimuHostingNodeDriver
r = RimuHostingNodeDriver(‘4d5e3b5b1d6784jwisu&iwla4c46ba04’)

#get nodes
all_nodes = r.list_nodes()
print all_nodes

You’ll get something back like a listing of all active VPS.  You can see whether or not the VPSs are up/down and some basic information about them from.  Let’s say that you wanted to reboot a particular instance programatically.  You’d do something like this to reboot your VPS named

from libcloud.drivers.rimuhosting import RimuHostingNodeDriver
r = RimuHostingNodeDriver(‘4d5e3b5b1d6784jwisu&iwla4c46ba04′)

#get nodes
all_nodes = r.list_nodes()

#reboot VPS
r.reboot_node(filter(lambda x:’’, all_nodes)[0])

You can place an order for a new VPS (fresh install or clone an existing VPS).  To setup a new VPS, you’ll need to have a valid image (distro) and size (plan) selected.  Those can be printed via the following:

from libcloud.drivers.rimuhosting import RimuHostingNodeDriver
r = RimuHostingNodeDriver(‘4d5e3b5b1d6784jwisu&iwla4c46ba04′)

#get available images
all_distros = r.list_images()

#get available sizes
all_sizes = r.list_sizes()

#to setup a MiroVPS1 plan with lenny, you’d use:

#create clean VPS
size = filter(lambda x:’MIRO1′, all_sizes)[0]
distro = filter(lambda x:’lenny’, all_distros)[0]

#to destroy that later, you’d use:

#destroy VPS

all_nodes = r.list_nodes()
r.destroy_node(filter(lambda x:’’, all_nodes)[0])

Billing is handled automatically and you need to have an active server with us in order to place orders via the api.  Shutdowns are run immediately and your account will be credited with any unused hosting time at the time of the shutdown.

The above snippets should be enough to help you get started.  The next step is putting this all together to create a platform which can scale up automatically when the going gets rough.

2 responses to “Using libcloud with RimuHosting”

  1. Technically if somebody was Savvy, they would easily resell our VPS as their own. Just order a VPS, write their own web interface which worked with that, and presto.