# MinIO

Documentation related to the MinIO S3-compatible Object Storage Server

# 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

<p class="callout info">Make sure [Server Authentication](https://kb.oliver-karger.de/books/minio/page/server-authentication "Server Authentication") is setup!</p>

```
mc mb <name>/<bucket-name>
```

# Create User

<p class="callout info">Make sure [Server Authentication](https://kb.oliver-karger.de/books/minio/page/server-authentication "Server Authentication") is setup!</p>

```
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

```json
{
  "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:

```json
{
  "Action": [
    "s3:GetBucketLocation",
    "s3:ListBucket"
  ],
  "Effect": "Allow",
  "Resource": "arn:aws:s3:::<bucket-name>"
},
```

- Allows Listing and Location Info for Bucket `arn:aws:s3:::<bucket-name>`

```json
    {
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::<bucket-name>/*"
    }
```

- Allows Get (Read), Put (Upload) and Delete (Guess?) Permissions on Bucket `arn:aws:s3:::<bucket-name>` and to all Subdirectories `/*`

#### 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>
```