Archive for July, 2010

swift / saio amazon install

Thursday, July 22nd, 2010

So, I am pretty interested in cloud computing of late and thought I would give swift from openstack a shot.  After going through the several steps described here, I decided to try and script the process.  Here are the (hopefully) much simpler steps.

  1. Create an instance at Amazon using ami-bd37ded4 which is Ubuntu 10.4.
  2. Shell to your instance as the ubuntu user.
  3. wget http://blog.spack.net/saio.sh
  4. sudo bash saio.sh

Once the script finishes if you source your /etc/profile (. /etc/profile) to pick up a couple environment variables you should be able to see something by running

$ st stat

st is a command line tool for interacting with swift.  Type st<ENTER> to see some options.

A few notes.  The saio.sh script needs to be run as root and it will grab a couple more scripts (saio-guest-1.sh and saio-guest-2.sh) that get run as the user you create.  You can set a few environment variables before running the scripts if you like,  but the defaults will likely work just fine for you.

DISK_SIZE – size in bytes for how big of a drive to make, defaults to 10240.  The scripts just create a loop back device

MY_USER – user to run swift as, defaults to swift

MY_GROUP – group to run swift as, defaults to $MY_USER

MY_SHELL – shell for $MY_USER, defaults to /bin/bash

We now can poke around a bit using st.  Let’s make some dummy content

$ mkdir my_cool_directory

$ for i in {1..5};do echo “howdy file $i on `date`” >> my_cool_directory/$i; done

$ st upload my_cool_container my_cool_directory

Then you can try a couple things like

$ st stat

Account: aea05981-0136-4024-a2b1-d015df8e0c96
Containers: 1
Objects: 0
Bytes: 0

$ st list

my_cool_container

$ st list my_cool_container

my_cool_directory/1
my_cool_directory/2
my_cool_directory/3
my_cool_directory/4
my_cool_directory/5

I think the beauty of cloud computing is that for 8.5 cents (an hour) you can test out a likely pretty cool new offering.  Eventually, I would like to provide a lasic script that might be a touch cleaner, but I think this rather clean 🙂

Enjoy!

Earl