Dewpoint: a command-line tool for cloud computing

In September of last year I was on sabbatical and doing some research into cloud hosting. During my experimentation, I began looking for a good command-line tool for interacting with cloud server instances. To my surprise, I wasn’t able to find one for the provider I was working with, Rackspace Cloud. What I did find was an excellent abstraction library called libcloud.

What libcloud offers is a consistent Python API for performing common cloud server operations across a wide variety of providers. You can create new instances, destroy instances, list the instances you control, and so on. It’s a powerful tool and you should check it out: http://incubator.apache.org/libcloud/

However, it still wasn’t exactly what i was looking for. I wanted a tool that worked in a similar fashion to a command-line version control or package management program. So, I decided to write one. After all, about 99% of the work was already done for me by libcloud.

The result is a program called Dewpoint (hey, most of the other cloud or water vapor related names have already been snagged by startups). With Dewpoint, you create a simple configuration file in ~/.dewpoint/dewpoint.ini which defines your access information for your provider. That configuration file might look something like this:

# ~/.dewpoint/dewpoint.ini
[default]
provider: rackspace

[rackspace]
user: YOUR USER
key: YOUR API KEY
default_size: 256
default_image: Ubuntu 10.04 LTS (lucid)

Then, you can easily work with your cloud server nodes at the command line like this:

# find out what sizes and types of nodes are available from your provider
# (these lists are truncated to just three items for clarity)
 
$ dewpoint list-sizes
-----
name: 256 server
price: None
ram: 256
bandwidth: None
disk: 10
id: 1
-----
name: 512 server
price: None
ram: 512
bandwidth: None
disk: 20
id: 2
-----
name: 1GB server
price: None
ram: 1024
bandwidth: None
disk: 40
id: 3
-----
 
$ dewpoint list-images
-----
id: 49
name: Ubuntu 10.04 LTS (lucid)
-----
id: 10
name: Ubuntu 8.04.2 LTS (hardy)
-----
id: 51
name: CentOS 5.5
-----
 
# create a new node using your default settings
 
$ dewpoint create-node my-new-node
Node "my-new-node" created!
-----
flavor_id: 1
state_name: pending
name: my-new-node
public_ip: ['184.106.78.243']
image_id: 49
state: 3
private_ip: ['10.180.166.56']
password: my-new-nodeND7E4b1qj
uuid: 07135bb6e6954f497bec08ab8a4659212c3c7e23
-----
 
# get a list of your nodes
 
$ dewpoint list-nodes
-----
flavor_id: 1
state_name: running
name: my-new-node
public_ip: ['184.106.78.243']
image_id: 49
state: 0
private_ip: ['10.180.166.56']
password: None
uuid: 07135bb6e6954f497bec08ab8a4659212c3c7e23
-----
 
# find the details of a specific node
 
$ dewpoint find-node my-new-node
-----
flavor_id: 1
state_name: running
name: my-new-node
public_ip: ['184.106.78.243']
image_id: 49
state: 0
private_ip: ['10.180.166.56']
password: None
uuid: 07135bb6e6954f497bec08ab8a4659212c3c7e23
-----
 
# how about we get that same information (or the output of any Dewpoint command) in json format?
 
$ dewpoint find-node my-new-node -j
{
  "data": [
    {
      "flavor_id": "1", 
      "image_id": "49", 
      "name": "my-new-node", 
      "password": null, 
      "private_ip": [
        "10.180.166.56"
      ], 
      "public_ip": [
        "184.106.78.243"
      ], 
      "state": 0, 
      "state_name": "running", 
      "uuid": "07135bb6e6954f497bec08ab8a4659212c3c7e23"
    }
  ]
}
 
# we're done with that node -- let's delete it
 
$ dewpoint destroy-node my-new-node
Node "my-new-node" destroyed!

Dewpoint is open source, under the Apache License Version 2.0 (just like libcloud itself). It’s written in Python, and hosted on github at https://github.com/secondstory/dewpoint. So far it’s only been tested against Rackspace Cloud, because that’s what I use it for, but I believe the interface should be capable of supporting other libcloud-supported providers without too much additional work.

If you like what you see, please use it and let me know what you think!  Even better, fork it and add support for your favorite cloud provider.

About

Second Story creates enchanting, informative, and entertaining media experiences with innovative technologies that empower connections to ideas.

Tagged with: , , , ,
Posted in Technology