MinIO’s training team recently completed a multi-part series on MinIO event monitoring, in which Will Dinyes brings us through five in-depth videos. By the end of the video series you should be able to register an event destination, subscribe to an event notification, and deploy a custom Python-based webhook.
Will kicks off the MinIO event monitoring series with an overview of the event structure of MinIO, including an overview of bucket and object events that enable you to see what’s going on in the system. MinIO supports most S3 event notifications—a notable exception is ACL notifications. There are three categories of object events: accessed, created, and removed. MinIO has also implemented event types that are not part of the S3 standard; they’re MinIO-only, meaning they’re not compatible with AWS S3. These include S3 scanner and bucket events. Bucket events allow you to watch if a bucket is created or removed and is part of the entire site wide system.
The second video in the series looks at event destinations and event notifications and how they work together to publish events from the MinIO server. MinIO supports reporting to three types of destinations: database, queue, and webhook. As for databases, MinIO supports PostgreSQL, MySQL, and Elasticsearch. Message queues allow for persisting of messages until they are handled. Webhook event destination is what you use if your preferred service is not directly available—you can write or deploy a webhook as a good option. You can also write custom code to handle events with a dedicated service. Event destinations are cluster-wide, meaning you will set up your event destination once, and it can be re-used for many event notifications. After Will walks through how to register event destinations, he details per-bucket notifications and system-wide notifications.
The third video covers setting up webhooks using Python. Webhooks provide amazing flexibility: a single webhook may respond to multiple subscriptions to various different event notifications, and you can have separate webhooks for different event types. The only real requirement is that you have to be able to receive events via SQS. Using Python for your webhook makes for a seamless process as Python is really simple to use; it’s a language that is easily understood. There’s an extension to Python called Flask, which allows you to deploy a webservice in Python trivially—it’s very simple. Additionally, since MinIO provides a robust SDK for Python, you can use the Flask extensions and the MinIO extensions, you can develop a very robust webhook without spending a lot of time or having to stand up a whole other server or service.
The fourth video dives deeper into the process of using MinIO Python SDK to set up and manage notifications. The MinIO library is fully integrated with pip for ease of installation and is largely method-driven, requiring fewer class imports. The key object is the MinIO client, which can be used to perform all the tasks in MinIO. The arguments passed to the MinIO constructor vary based on deployment. By default, all connections will use TLS/HTTPS. The MinIO Python SDK has a robust set of tools to examine objects and buckets, for example: listing buckets and objects, working with versioning, and managing bucket replication.
The fifth and final video in this series consists of a lab walkthrough of managing MinIO notifications and events using MinIO client commands and basic Python to set up webhooks.
You made it to the end of the MinIO Event Notifications training series! We hope that this breakdown has been informative. For more detailed information about installing, running, and using MinIO in any environment, please refer to our documentation here. To learn more about MinIO or get involved in our community, please visit us at min.io or join our public slack channel. If you want to see our other series summaries, you can use the YouTube Summaries tag on our blog.