Minio, a powerful self-hosted object storage

TL, DR

Minio is a powerful open source self-hosted object storage, similar to S3, that you can deploy on your own hardware or cloud instance. You can also deploy it on a Raspberry Pi. It has a comprehensive Python SDK for all operations.

Minio Server

Minio is a powerful open source software that enables you to deploy S3-like object storage on your own hardware or virtual machine. This is particularly handy when you want to keep your object storage in your local environment. Furthermore, you can deploy Minio on a Raspberry Pi for a home-usage object storage.

There are many plus in having a local object storage, especially when it comes to development or small home applications. The possibility to reuse a spare Raspberry Pi and hard drive, together with no fees for storage and object retrieval makes Minio very attractive for hobby projects or initial stages of development.

In case you use a Raspberry Pi, I suggest to place the storage on an external hard drive or SSD in order to have more space and less load on the microSD card.

Minio Python SDK

Minio provides you with a comprehensive Python SDK that you can use in your own applications. The client is fully equipped with all functionalities to manage your object storage, and it presents many similarity with boto3 from AWS. You can easily install the client with pip this way:

pip install minio

The documentation is quite exhaustive, and it will guide you for all operations you want to perform. Below you can find a quick example for file upload, that also catch potential upload errors printing them to standard output.

from minio import Minio
from minio.error import ResponseError

client = Minio('s3.amazonaws.com',
               access_key='YOUR-ACCESSKEYID',
               secret_key='YOUR-SECRETACCESSKEY')

# Put a file with default content-type.
try:
    with open('my-testfile', 'rb') as file_data:
        client.put_object('my-bucketname', 'my-objectname',
                          file_data)
except ResponseError as err:
    print(err)

You can also list all files in your bucket in a very simple way. Example code is the following:

from minio import Minio

client = Minio('s3.amazonaws.com',
               access_key='YOUR-ACCESSKEYID',
               secret_key='YOUR-SECRETACCESSKEY')

# List all object paths in bucket using
# V2 listing API.
objects = client.list_objects_v2('my-bucketname',
                                 recursive=True)
for obj in objects:
    print(obj.bucket_name, obj.object_name.encode('utf-8'), obj.last_modified,
          obj.etag, obj.size, obj.content_type)

Minio summary

To sum everything up, Minio is a fantastic open source self-hosted object storage that you can deploy locally or on any cloud. It provides a great Python SDK for integration in any project of yours. In my opinion, you should give it a try!

Related links

  • Minio website link
  • Python SDK documentation for Minio link
  • Minio server download link
  • Guide to deploy Minio on a Raspberry Pi link

Do you like our content? Check more of our posts in our blog!