Skip to content

Instantly share code, notes, and snippets.

@novel
Created May 6, 2011 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save novel/958696 to your computer and use it in GitHub Desktop.
Save novel/958696 to your computer and use it in GitHub Desktop.
Example of connecting to OpenStack's EC2-compatible API using libcloud
#!/usr/bin/env python
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
EC2_ACCESS_KEY=""
EC2_SECRET_KEY=""
# EC2_URL="http://192.168.0.1:8773/services/Cloud"
if __name__ == "__main__":
Driver = get_driver(Provider.EUCALYPTUS)
conn = Driver(EC2_ACCESS_KEY, secret=EC2_SECRET_KEY,
host="192.168.0.1", secure=False, port=8773,
path="/services/Cloud")
print conn.list_nodes()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment