Raja's Exocortex

Minio Single Node Docker with Bucket Replication

Single Node Single Drive docker-compose.yaml

# Single Node Single Drive docker-compose.yaml

version: '3'

name: minio-hanoi

services:
  minio:
    image: minio/minio
    container_name: minio.hanoi
    restart: always

    ports:
      - "7000:7000"
      - "7001:7001"

    volumes:
      - ./data:/data

    environment:
      MINIO_ROOT_USER: admin
      MINIO_ROOT_PASSWORD: admin12345

    command: server --address ":7000" --console-address ":7001" /data

Setting IAM Policies for Replication

Ref: https://github.com/minio/minio/blob/master/docs/bucket/replication/README.md

Source Bucket Policy

Change zz-test bucket ID in below.

{
 "Version": "2012-10-17",
 "Statement": [
  {
    "Action": [
        "admin:SetBucketTarget",
        "admin:GetBucketTarget"
    ],
    "Effect": "Allow",
    "Sid": ""
  },
  {
   "Effect": "Allow",
   "Action": [
    "s3:GetReplicationConfiguration",
    "s3:PutReplicationConfiguration",
    "s3:ListBucket",
    "s3:ListBucketMultipartUploads",
    "s3:GetBucketLocation",
    "s3:GetBucketVersioning"
   ],
   "Resource": [
    "arn:aws:s3:::zz-test"
   ]
  }
 ]
}

Target Bucket Policy

Change zz-test bucket ID in two places below.

{
 "Version": "2012-10-17",
 "Statement": [
  {
   "Effect": "Allow",
   "Action": [
    "s3:GetReplicationConfiguration",
    "s3:ListBucket",
    "s3:ListBucketMultipartUploads",
    "s3:GetBucketLocation",
    "s3:GetBucketVersioning",
    "s3:GetBucketObjectLockConfiguration"
   ],
   "Resource": [
    "arn:aws:s3:::zz-test"
   ]
  },
  {
   "Effect": "Allow",
   "Action": [
    "s3:GetReplicationConfiguration",
    "s3:ReplicateTags",
    "s3:AbortMultipartUpload",
    "s3:GetObject",
    "s3:GetObjectVersion",
    "s3:GetObjectVersionTagging",
    "s3:PutObject",
    "s3:DeleteObject",
    "s3:ReplicateObject",
    "s3:ReplicateDelete"
   ],
   "Resource": [
    "arn:aws:s3:::zz-test/*"
   ]
  }
 ]
}

Access Key mc-cli

Secret Key V8pZmguCawEaLXAYXSiIDO0bgw3acXm4DkndUDtk


mc alias set hanoi http://hanoi:7000 mc-cli V8pZmguCawEaLXAYXSiIDO0bgw3acXm4DkndUDtk

mc mb hanoi/zz-test
mc version enable hanoi/zz-test



# add a replication user
mc admin user add hanoi replication replication12345



Get replication policies:



# add policy to minio
mc admin policy create hanoi replication-source replication-source.json

mc admin policy create hano replication-target replication-target.json


# attach replication-source policy to replication user
mc admin policy attach hanoi replication-source --user replication

# verify replication user has the replication-source policy applied
mc admin user info hanoi replication

# Check all policies attached to users/groups
mc admin policy entities hanoi


mc replicate add hanoi/zz-test --priority 1 --remote-bucket http://replicaiton-target:otKCed0W3wnPCo49SNGYxy270vPt3iXnVrYNXAZq@moocher:7000/zz-test --replicate existing-objects,delete,delete-marker