Howto use Cyberduck with Rackspace Cloud UK

If you are wondering howto use a graphical client like Cyberduck to access the Rackspace Cloud UK this is how you do it. We are going to use the Swift OpenStack support in Cyberduck to access the UK CloudFiles instance.

You first Open Cyberduck and Click on open connection :

In the Menu choose Swift (OpenStack Object Storage) and in Server field you specify :

and enter your Username and Api Key (in Password field) :

You should just be able to press connect to get going, if it is asking for a Password again in the next screen (which is to store in your Apple Keychain) just specify your API Key again in there.

How-to use the Rackspace Cloud UK API

Rackspace just released the public beta for the UK version of Rackspace Cloud. The UK Rackspace Cloud doesn’t have the same auth server as the US Cloud so there is a few change you need to do to support the UK Rackspace Cloud. This is the same way Amazon has different zone for EC2 we have now different geographical zone between the US and now the UK.

If you access directly, you just need to adjust the Auth URL in your code to go to :

instead of :

The language binding provided by Rackspace has all been updated and available from github :

For Python CloudFiles :

 cnx = cloudfiles.Connection(api_username, api_key, authurl="

For Python CloudServers :

    cloudservers.CloudServers("USERNAME", "API_KEY", auth_url="")

For Ruby CloudFiles :

require 'cloudfiles'

  # Log into the Cloud Files system
cf =
                                :username => "USERNAME",
                                :api_key => "API_KEY",
                                :authurl => ""

For C# CloudFiles :

UserCredentials userCreds = new UserCredentials(new Uri(""), username, api_key, null, null);
Connection connection = new com.mosso.cloudfiles.Connection(userCreds);

For Java CloudFIles add a file in your classpath with this content :


and you would be able to access it like this without any argument to the constructor :

FilesClient client = new FilesClient();

For non rackspace binding I have sent a patch for Apache libcloud :

which when integrated would allow to do something like this :

for jclouds you can just pass the auth server like this for cloudfiles :

and like this for cloudservers :

for Ruby Fog :

require 'rubygems'
require 'fog'

rackspace =
  :rackspace_api_key => "",
  :rackspace_username => "",
  :rackspace_auth_url => ""

Automatically spawn Rackspace Cloud Servers and customise it.

Lately I had to spawn some cloud servers and automatically customise them.

I have used the python-cloudservers library and installed it automatically with pypi (works for Debian/Ubuntu you may want to check for other distros):

pypi-install python-cloudservers

From there writing the script was pretty straight forward, I needed to know what type of CloudServers I wanted which in my case the smallest was good enough which is number 1 for me.

If you want to see all flavours you can do something like that from python command prompt

import cloudservers
cs = cloudservers.CloudServers("API_USERNAME", "API_PASSWORD")
for i in cs.flavors.list():
    print "ID: %s = %s" % (,

which should output something like this at the time this article has
been written :

ID: 1 - 256 server
ID: 2 - 512 server
ID: 3 - 1GB server
ID: 4 - 2GB server
ID: 5 - 4GB server
ID: 6 - 8GB server
ID: 7 - 15.5GB server

You need to figure out the image type as well which is basically the Operating System, in this case I wanted Ubuntu Maverick which is 69. If you want to see all image type you can do :

import cloudservers
cs = cloudservers.CloudServers("API_USERNAME", "API_PASSWORD")
for i in cs.images.list():
    print "ID: %s = %s" % (,

which print something like this for me at this time :

ID: 29 = Windows Server 2003 R2 SP2 x86
ID: 69 = Ubuntu 10.10 (maverick)
ID: 41 = Oracle EL JeOS Release 5 Update 3
ID: 40 = Oracle EL Server Release 5 Update 4
ID: 187811 = CentOS 5.4
ID: 4 = Debian 5.0 (lenny)
ID: 10 = Ubuntu 8.04.2 LTS (hardy)
ID: 23 = Windows Server 2003 R2 SP2 x64
ID: 24 = Windows Server 2008 SP2 x64
ID: 49 = Ubuntu 10.04 LTS (lucid)
ID: 14362 = Ubuntu 9.10 (karmic)
ID: 62 = Red Hat Enterprise Linux 5.5
ID: 53 = Fedora 13
ID: 17 = Fedora 12
ID: 71 = Fedora 14
ID: 31 = Windows Server 2008 SP2 x86
ID: 51 = CentOS 5.5
ID: 14 = Red Hat Enterprise Linux 5.4
ID: 19 = Gentoo 10.1
ID: 28 = Windows Server 2008 R2 x64
ID: 55 = Arch 2010.05
ID: 6719676 = Backup-Image

Now to make stuff going automatic we send our ~/.ssh/id_rsa to ‘/root/.ssh/authorized_keys’ and assuming you have a properly
configured ssh-agent which was already identified you have a passwordless access and you can launch command.

I have a script that does basic customisations at :

but you get the idea from there to launch the command the way you want, you can as well scp and ssh it after if you wanted to have some non public stuff in the script.

Here is the full script you need to adjust a few variable at the top of the file and customize it the way you want but that should get you started :

Upload a file to Rackspace Cloud Files from Windows

I don’t have to use much of the Windows Operating System except when I have to  synchronize my Garmin GPS to use the excellent SportsTrack software for my fitness training.

I wanted to get safe and backup my SportsTrack ‘logbook’ directly to Rackspace Cloud Files; while this is easy to do from Linux using some other script I made but I haven’t had anything at hand for Windows without having to install bunch of Unix tools.

So I made a quick C# CLI binary to allow just do that and do my backups via a ‘Scheduler Task’ (or whatever cron is called on Windows).

It’s available here :

and note that you will need nant to compile it.

Using Jython with the vCloud API

Lately I had to do a lot of works with the VMware VCloud product and since the python API did not seem available and I did not have the courage to use the PHP API I had to do most of the API works with Java. I never did any Java before and while I have found Eclipse+Java development surprisingly pleasant and easy to use/learn my favourite are still Emacs+Python.

I have then started to look over Jython to see if I can interact easily with Java via Python and this was actually pretty easy, it took me less than 10mn to convert a Login/Listing-VAPPS script in Jython.

The script is attached at the end of this post (or on github gist here). Don’t forget to adjust the classpath variable mine are defined like that :


Most of them are the ones shipped with the official Java API

Here is the script  the __main__ should get you the logic and a start how to use it :
import sys

from org.apache.commons.httpclient.protocol import Protocol
from com.vmware.vcloud.sdk  import VcloudClient, Organization, Vdc
from com.vmware.vcloud.sdk.samples import FakeSSLSocketFactory

class VcloudLogin(object):
    VcloudLogin: Login to vcloud class
    vcloudClient = None
    api_version = None
    vcloud_url = None
    def __init__(self, vcloud_url, api_version):
        # This is needed if you have a self certified certificate
        # remove it if you have a proper SSL certs.
        self.vcloud_url = vcloud_url
        self.api_version = api_version
    def setup_fake_ssl(self):
        https = Protocol("https", FakeSSLSocketFactory(), 443)
        Protocol.registerProtocol("https", https)

    def login(self, username, password):
        versions = VcloudClient.getSupportedVersions(self.vcloud_url + "/api/versions")
        self.vcloudClient = VcloudClient(versions.get(self.api_version))
        return self.vcloudClient.login(username, password)

if __name__ == '__main__':

    vcl = VcloudLogin(URL, API_VERSION)
    organizations_list = vcl.login(USERNAME, PASSWORD)

    for org in organizations_list.values():
        for vdcLink in \
                Organization.getOrganizationByReference(vcl.vcloudClient, org).getVdcLinks():
            vdc = Vdc.getVdc(vcl.vcloudClient, vdcLink)
            print "VDC Href: %s\n" % (vdcLink.getHref())
            for vapps in vdc.getVappRefs():
                print "Name: %s URL: %s" % (vapps.getName(), vapps.getHref())