Rackspace OpenStack in 5min

by Sebastien Mirolo on Sat, 16 Jun 2012

[UPDATED] Use these instructions to use the version 2.0 API from Rackspace instead.

Booting and starting virtual machines on a openstack cloud is pretty straightforward.

First, you will need to figure out the authentication end point. That's usually pretty straightforward using Google. Then you get your API_KEY. If you are using Rackspace, log into the web interface, and follow through to Your Account > API Access > Show Key. Finally you will need to figure out a "tenant" (i.e. data center) to host your virtual machine. Again, if you already have a virtual machine up and running on rackspace, you can just copy/paste the information from the web dashboard for a start.

After you figure this information out, things get easy. Just install the python novaclient, set a few environment variables and start your first vm from the command-line!

$ sudo port install py27-novaclient
# Example (Rackspace Chicago)
$ export OS_AUTH_URL="https://identity.api.rackspacecloud.com/v2.0/"
$ export OS_COMPUTE_API_VERSION="2.0"
$ export OS_TENANT_NAME="ORD1"
$ export OS_USERNAME=Your rackspace login
$ export OS_PASSWORD=Your API key

# List available images
$ nova-2.7 image-list

# Generate a keypair to access the cloud instances
$ ssh-keygen -q -f ~/.ssh/cloud_rsa -t rsa

# Boot a Fedora 17 VM
# nova-2.7 boot --image 122 --key ~/.ssh/cloud_rsa.pub first_cli_booted_vm

# List of virtual machine in the account
$ nova-2.7 list

# Remote shell on the new VM
$ ssh -v -i ~/.ssh/cloud_rsa root@ipaddr

# Suspend and delete the VM
$ nova-2.7 suspend first_cli_booted_vm
$ nova-2.7 delete first_cli_booted_vm

Booting cloud instances from the command line is fun; configuring clusters of them becomes quickly an headache. That's why there are projects such as cloudify. A good introduction is available on slideshare.

by Sebastien Mirolo on Sat, 16 Jun 2012