MinIO Client
MinIO Client is a command-line interface that supports connection to S3-compatible cloud services and provides modern alternatives to classic UNIX commands for working with files and folders.
Set up MinIO Client
1. Configure S3 access
Access can be configured by the Account Owner or a user with the iam.admin role.
- Create a service user with a role with access to S3. If you are using a service user with the
s3.user,object_storage_userors3.bucket.userrole, an access policy must be configured in the bucket and its rules must allow access to this user. - Issue an S3 key to the user.
2. Install the client
Linux
Windows
macOS
-
Open the CLI.
-
Install the client:
curl https://dl.min.io/client/mc/release/linux-amd64/mc \--create-dirs \-o $HOME/minio-binaries/mcchmod +x $HOME/minio-binaries/mcexport PATH=$PATH:$HOME/minio-binaries/
3. Configure the client
-
Add an alias:
mc alias set <alias_name> https://<s3_domain>Specify:
<alias_name>— the alias (connection) name;<s3_domain>— S3 API domain. The domain depends on the pool where S3 is located.
-
In the Enter Access Key field, specify the value of the Access key field from the S3 key.
-
In the Enter Secret Key field, specify the value of the Secret key field from the S3 key.
-
Test the connection:
mc ls <alias_name>Specify
<alias_name>— the alias name.A list of buckets will appear in the response.
Working with MinIO Client
List aliases
-
Open the CLI.
-
List the aliases:
mc alias list
Add an alias
-
Open the CLI.
-
Add an alias:
mc alias set <alias_name> https://<s3_domain>Specify:
<alias_name>— the alias name; you can view it using themc alias listcommand;<s3_domain>— S3 API domain. The domain depends on the pool where S3 is located.
Delete an alias
-
Open the CLI.
-
Delete an alias:
mc alias remove <alias_name>Specify
<alias_name>— the alias name; you can view it using themc alias listcommand.
Create a bucket
You can only create a bucket with the standard storage class using MinIO Client.
If you need a different storage class, create the bucket using other tools or the control panel.
-
Open the CLI.
-
Create a bucket:
mc mb <alias_name>/<bucket_name>Specify:
<alias_name>— the alias name; you can view it using themc alias listcommand;<bucket_name>— the bucket name.
A private bucket will be created.
-
Optional: change the bucket type to public.
List buckets
-
Open the CLI.
-
List the buckets:
mc ls <alias_name>Specify
<alias_name>— the alias name; you can view it using themc alias listcommand.
Enable versioning
-
Open the CLI.
-
Enable versioning:
mc version enable <alias_name>/<bucket_name>Specify:
<alias_name>— the alias name; you can view it using themc alias listcommand;<bucket_name>— the bucket name.
Suspend versioning
-
Open the CLI.
-
Suspend versioning:
mc version suspend <alias_name>/<bucket_name>Specify:
<alias_name>— the alias name; you can view it using themc alias listcommand;<bucket_name>— the bucket name.
List the objects in a bucket
-
Open the CLI.
-
List the objects in the bucket:
mc ls <alias_name>/<bucket_name>Specify:
<alias_name>— the alias name; you can view it using themc alias listcommand;<bucket_name>— the bucket name.
Upload an object
-
Open the CLI.
-
Upload an object:
mc cp "/<local_path>" "<alias_name>/<bucket_name>/<object_name>"Specify:
<local_path>— the path to the file on the device;<alias_name>— the alias name; you can view it using themc alias listcommand;<bucket_name>— the bucket name;<object_name>— the name the object will be uploaded with.
Download an object or folder
-
Open the CLI.
-
Download an object or folder:
mc cp "<alias_name>/<bucket_name>/<path>" "/<download_path>"Specify:
<alias_name>— the alias name; you can view it using themc alias listcommand;<bucket_name>— the bucket name;<path>— the path to the object or folder in the S3 bucket;<download_path>— the path to the folder on the device where the object or folder will be downloaded.
Delete an object or folder
-
Open the CLI.
-
Delete an object or folder:
mc rm "<alias_name>/<bucket_name>/<path>"Specify:
<alias_name>— the alias name; you can view it using themc alias listcommand;<bucket_name>— the bucket name;<path>— the path to the object or folder in the S3 bucket.