MinIO Storage Driver Documentation

MinIO is high performance, Kubernetes native object storage which exposes S3 compatible API.

../../_images/minio.png

Libcloud MinIO driver utilizes BaseS3StorageDriver class which utilizes S3 API.

Examples

1. Connect to local MinIO installation

This example show how to connect to local MinIO installation which is running using Docker containers (https://docs.min.io/docs/minio-docker-quickstart-guide.html).

from libcloud.storage.types import Provider
from libcloud.storage.types import ContainerAlreadyExistsError
from libcloud.storage.providers import get_driver

FILE_PATH = "/home/user/myfile.tar.gz"

cls = get_driver(Provider.MINIO)
driver = cls("api key", "api secret key", secure=False, host="127.0.0.1", port=9000)

try:
    driver.create_container(container_name="my-backups-12345")
except ContainerAlreadyExistsError:
    pass

container = driver.get_container(container_name="my-backups-12345")

# This method blocks until all the parts have been uploaded.
with open(FILE_PATH, "rb") as iterator:
    obj = driver.upload_object_via_stream(
        iterator=iterator, container=container, object_name="backup.tar.gz"
    )