Skip to content

Instantly share code, notes, and snippets.

@justinlund
Created February 20, 2015 22:13
Show Gist options
  • Save justinlund/b604386c13f086a06f26 to your computer and use it in GitHub Desktop.
Save justinlund/b604386c13f086a06f26 to your computer and use it in GitHub Desktop.
Using Apache LibCloud to launch a DreamCompute subsonic Ubuntu 14.04 instance
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
OpenStack = get_driver(Provider.OPENSTACK)
driver = OpenStack('username', 'password',
ex_force_auth_url='https://keystone.dream.io/v2.0/tokens',
ex_force_auth_version='2.0_password',
ex_tenant_name='dhc12345678')
sizes = driver.list_sizes()
images = driver.list_images()
size = [s for s in sizes if s.name == 'subsonic'][0]
image = [i for i in images if 'Ubuntu-14.04-Trusty' in i.name][0]
node = driver.create_node(name='libcloud', size=size, image=image, ex_keyname='my-keypair')
print(node)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment