Skip to main content

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.
  2. Install the client.
  3. Configure the client.

1. Configure S3 access

Access can be configured by the Account Owner or a user with the iam.admin role.

  1. Create a service user with a role with access to S3. If you are using a service user with the s3.user, object_storage_user or s3.bucket.user role, an access policy must be configured in the bucket and its rules must allow access to this user.
  2. Issue an S3 key to the user.

2. Install the client

  1. Open the CLI.

  2. Install the client:

    curl https://dl.min.io/client/mc/release/linux-amd64/mc \
    --create-dirs \
    -o $HOME/minio-binaries/mc

    chmod +x $HOME/minio-binaries/mc
    export PATH=$PATH:$HOME/minio-binaries/

3. Configure the client

  1. 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.
  2. In the Enter Access Key field, specify the value of the Access key field from the S3 key.

  3. In the Enter Secret Key field, specify the value of the Secret key field from the S3 key.

  4. 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

  1. Open the CLI.

  2. List the aliases:

    mc alias list

Add an alias

  1. Open the CLI.

  2. Add an alias:

    mc alias set <alias_name> https://<s3_domain>

    Specify:

    • <alias_name> — the alias name; you can view it using the mc alias list command;
    • <s3_domain>S3 API domain. The domain depends on the pool where S3 is located.

Delete an alias

  1. Open the CLI.

  2. Delete an alias:

    mc alias remove <alias_name>

    Specify <alias_name> — the alias name; you can view it using the mc alias list command.

Create a bucket

For your information

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.

  1. Open the CLI.

  2. Create a bucket:

    mc mb <alias_name>/<bucket_name>

    Specify:

    • <alias_name> — the alias name; you can view it using the mc alias list command;
    • <bucket_name> — the bucket name.

    A private bucket will be created.

  3. Optional: change the bucket type to public.

List buckets

  1. Open the CLI.

  2. List the buckets:

    mc ls <alias_name>

    Specify <alias_name> — the alias name; you can view it using the mc alias list command.

Enable versioning

  1. Open the CLI.

  2. Enable versioning:

    mc version enable <alias_name>/<bucket_name>

    Specify:

    • <alias_name> — the alias name; you can view it using the mc alias list command;
    • <bucket_name> — the bucket name.

Suspend versioning

  1. Open the CLI.

  2. Suspend versioning:

    mc version suspend <alias_name>/<bucket_name>

    Specify:

    • <alias_name> — the alias name; you can view it using the mc alias list command;
    • <bucket_name> — the bucket name.

List the objects in a bucket

  1. Open the CLI.

  2. List the objects in the bucket:

    mc ls <alias_name>/<bucket_name>

    Specify:

    • <alias_name> — the alias name; you can view it using the mc alias list command;
    • <bucket_name> — the bucket name.

Upload an object

  1. Open the CLI.

  2. 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 the mc alias list command;
    • <bucket_name> — the bucket name;
    • <object_name> — the name the object will be uploaded with.

Download an object or folder

  1. Open the CLI.

  2. 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 the mc alias list command;
    • <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

  1. Open the CLI.

  2. Delete an object or folder:

    mc rm "<alias_name>/<bucket_name>/<path>"

    Specify:

    • <alias_name> — the alias name; you can view it using the mc alias list command;
    • <bucket_name> — the bucket name;
    • <path> — the path to the object or folder in the S3 bucket.