How to Create an Object Storage Bucket with MinIO Object Storage


MinIO is a great tool if you need to use object storage for any kind of need. For example, you can create object storage to use with your Kubernetes deployments. Imagine having a bunch of scalability with both container deployments and object storage. The sky, as they say, is the limit.

I’ve already walked you through the process of deploying MinIO on Rocky Linux, which can be done on local machines or even external cloud hosted systems. No matter where you deploy MinIO, you’ll need to create object collections that will be used to store all of that data (such as images, videos, documents, and more). This tutorial will show you how to do that.

One very useful aspect of MinIO is that it allows you to create object storage repositories from both the web user interface and the command line. This means that you can take care of the process, even if you don’t have a handy web browser and all you can do is SSH into this MinIO server. So whether you prefer a GUI or a CLI (Command Line Interface), it’s a good idea to use MinIO.

Let me show you how it’s done.

requirements

The only thing you will need for this is a running instance of MinIO and an admin user account to log in. This is it. Let’s get this storage offer on the road.

Create a storage bucket from the GUI

First, we’ll deal with the GUI side of things. Log in to your MinIO instance by pointing your browser to http://SERVER:9001 (where SERVER is either the domain or the IP address of the hosting server). You will be logged in with the username “admin” and the password that you created for the user during installation.

Upon successful login, you will be prompted to create the first storage container (Fig. 1).

Figure 1: MinIO installed and ready to create the first bucket.

Figure 1: MinIO installed and ready to create the first bucket.

Click Create Container. In the resulting window (Fig. 2), you must name the container (eg tnstest).

Figure 2: Creating a new storage container in MinIO.

After naming the container, you must then select the options you want to enable, which are:

  • Versioning allows you to keep multiple versions of an object under the same key.
  • Object Lock prevents someone from deleting an object. This option can only be enabled when the container is created for the first time.
  • Quota determines how much data can be stored in the container.

When you enable some of the above options, you will notice that more options appear. For example, if you enable Versioning, the new Keep option appears (to prevent object deletion for a specified period). Also, if you enable quota, you will then be prompted to define a quote in MB, GB, TB, BP, and EB. If you enable retention, you will then have to configure it in either compliance or governance mode as well as set the validity period (in days).

After making your configurations, click on create container and MinIO will do its thing. After creating the bucket it will be empty. You can click Upload (Figure 3) to upload your first file to the object storage container.

Figure 3: A newly created MinIO storage container.

Figure 3: A newly created MinIO storage container.

If you then click on the gear icon in the upper right corner of the window, you will find yourself in the container configuration window (Fig. 4), where you can take care of options such as access and encryption policies, quotas and replication,

Create collections from the CLI

Now, we will see how to do the same thing from the terminal window. Before we can do that, we must install the CLI client. Download the binary file with:

Grant the file the appropriate executable permissions with:

Verify the installation with the command:

You should see something like this in the output:

mc RELEASE version.2022-11-07T23-47-39Z (commit id=bc16bde337add744b25c47c4643491eba2a17c1b)
Runtime: go1.19.3 linux / amd64
Copyright (c) 2015-2022 MinIO, Inc. All rights reserved.
GNU AGPLv3 license

Now we need to add the MinIO server with the command:

Where SERVER is the domain or IP address of the hosting server and PASSWORD is the password you set for the admin user during MinIO installation.

You should see the following in the output:

You can view the list of current groups with the command:

You must see tnstest/ included in the output.

Let’s create a new bucket with the command:

You should see the following in the output:

Load files into the container from the command line

Let’s create a test file and upload it to our new tns-bucket2 bucket. First, create the test file with:

Next, upload the file to tns-bucket2 with:

The file should be downloaded immediately. To check if it is in the repository, list the contents with:

You should see the following in the output:

And that’s all there is to creating a new object storage container with the MinIO web interface and the mc command line tool. With a little shell scripting magic, you can even automate loading files into a container from the command line. Again, the sky is the limit.

Collection Created with Sketch.