libcloud With Wasabi

Prev Next

How do I use libcloud with Wasabi?

Apache Libcloud is certified for use with Wasabi. Wasabi is in the process of becoming formally listed on the libcloud provider page but in the interim, if you wish to use this product with Wasabi, you can use the standard S3 connector that is listed on that page.     

To use this connector, you can follow the example below:

from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver
from libcloud.storage.base import StorageDriver

FILE_PATH = '/Users/wasabi-test/qa/100kfile'

cls = get_driver(Provider.S3)
driver = cls('your_wasabi_access_key', 'your_wasabi_secret_key',host='s3.wasabisys.com')

container = driver.get_container(container_name='libcloud')

extra = {'meta_data': {'owner': 'myuser', 'created': '2014-02-2'}}

with open(FILE_PATH, 'rb') as iterator:
obj = driver.upload_object_via_stream(iterator=iterator,
container=container,
object_name='backup.tar.gz',
extra=extra)
~

Note that this example discusses the use of Wasabi's us-east-1 storage region. To use other Wasabi storage regions, please use the appropriate Wasabi service URL as described in this article.