Rackspace Compute Driver Documentation

Rackspace is a public and private cloud provider based in San Antonio, Texas with data centers in United States, United Kingdom, China and Australia.

../../_images/rackspace.png

Rackspace driver supports working with legacy, first-gen cloud servers and next-gen OpenStack based cloud servers.

Rackspace driver is based on the OpenStack driver so for more information about that and OpenStack specific documentation, please refer to OpenStack Compute Driver Documentation page.

Instantiating a driver

When you instantiate a driver you need to pass the following arguments to the driver constructor:

  • username - your Rackspace Cloud username
  • api_key - your Rackspace Cloud API key
  • region - Which region to use. Supported regions depend on the driver type (next-gen vs first-gen).

Instantiating a next-gen driver

Supported regions: dfw, ord, iad, lon, syd, hkg

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

cls = get_driver(Provider.RACKSPACE)
driver = cls('username', 'api key', region='iad')

Instantiating a first-gen driver

Keep in mind that first-gen cloud servers have been deprecated and you are strongly encouraged to use next-gen cloud servers.

Supported regions: us, uk

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

cls = get_driver(Provider.RACKSPACE_FIRST_GEN)

driver_us = cls('username', 'api key', region='us')
driver_uk = cls('username', 'api key', region='uk')

Examples

1. Working with ‘performance’ cloud server flavors

Rackspace recently announced new ‘performance’ flavors of their cloud servers. The example below shows how to use this new flavors.

Keep in mind that this new flavors are currently only supported in the following regions: iad, ord, lon.

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

cls = get_driver(Provider.RACKSPACE)
driver = cls('username', 'api key', region='iad')

sizes = driver.list_sizes()

performance_sizes = [size for size in sizes if 'performance' in size.id]

for size in performance_sizes:
    print(size)

API Docs