CLI

CLI Installation

1. Download Binary

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

2. Make Binary Executable

chmod +x $HOME/minio-binaries/mc

3. Add Binary to Path

export PATH=$PATH:$HOME/minio-binaries/

 

Server Authentication

To use the MinIO CLI mc, you need to setup a Connection to a S3 Server

mc alias set <name> http://localhost:9000 <user> <password>

 

Create Bucket

Make sure Server Authentication is setup!

mc mb <name>/<bucket-name>

 

Create User

Make sure Server Authentication is setup!

mc admin user add <name> <username> <password>

 

Create/Assign Access Policy

For a User to acccess a Bucket, you'll need to create a Access Policy that defines Permissions

These are defined in json

Example Definition File

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "s3:GetBucketLocation",
        "s3:ListBucket"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::<bucket-name>"
    },
    {
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::<bucket-name>/*"
    }
  ]
}
What this File does:
{
  "Action": [
    "s3:GetBucketLocation",
    "s3:ListBucket"
  ],
  "Effect": "Allow",
  "Resource": "arn:aws:s3:::<bucket-name>"
},
    {
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::<bucket-name>/*"
    }

Creating a Policy

mc admin policy create <name> <policy-name> <path-to-policy-json-file>

Applying a Policy

mc admin policy attach <name> <policy-name> user=<username>