Tuesday 8 December 2009

Cloud laziness part 1: creating a CloudServers server instance

The following is ongoing on my private branch of the CPAN dist Net::RackSpace::CloudServers, in which I'm creating an App::Cmd interface to the module:


okram@bluedesk: (with_app_cmd)
~/GIT/Net-RackSpace-CloudServers$ perl cloudservers.pl create \
--name=mfapitest --imagename karmic --flavorname 256 --verbose
Server name: mfapitest
Metadata:
Paths:
Image id 14362 named Ubuntu 9.10 (karmic)
Flavor id 1 named 256 server
Creating new server...
Created server ID 124999
root password: mfapitestXXXXXXX
Public IP: 174.143.242.999
Private IP: 10.176.140.999
Server status: ACTIVE progress: 100..
Server now available!

The same is indeed doable with the sample scripts/newserver.pl in the dist -- and I also need to use scripts/deleteserver.pl to destroy the test instance -- but I assume that a command-line interface may be useful in the longer term to scale up/down specific instances, create N new servers in a shared IP group, or destroy no longer needed instances.


The command was pretty painless to write, and most of it was the validate_args routine...


As usual, comments would be much appreciated!

Till soon,

-marco-