Skip to content

Set AWS S3 bucket permission with mc tool

homepage-banner

What is the MC Tool?

The MC tool is a command-line interface for managing and interacting with Amazon S3 buckets. MC stands for “MinIO Client”, which is a high-performance, distributed object storage system. The MC tool provides a simple way to manage S3 buckets and objects, including setting bucket permissions.

Setting Bucket Permissions with the MC Tool

To set bucket permissions using the MC tool, you first need to install and configure it. Once installed, you can use the following command to set bucket permissions:

Install mc

brew install minio/stable/mc

Usage

prepare mc-policy.json

{
 "Statement": [
    {
      "Sid":"PublicRead",
      "Effect":"Allow",
      "Principal": "*",
      "Action":["s3:GetObject","s3:GetObjectVersion"],
      "Resource":["arn:aws:s3:::BUCKET1/PREFIX1*","arn:aws:s3:::BUCKET1/PREFIX2*"]
    }
 ],
 "Version": "2012-10-17"
}
mc policy set [permission] [bucket-name]

mc policy set-json mc-policy.json s3/BUCKET1
mc policy get-json s3/BUCKET1/

Reference

  • https://docs.min.io/docs/minio-client-quickstart-guide.html
Leave a message