Set AWS S3 bucket permission with mc tool
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
Small world. Big idea!
- Welcome to visit the knowledge base of SRE and DevOps!
- License under CC BY-NC 4.0
- No personal information is collected
- Made with Material for MkDocs and generative AI tools
- Copyright issue feedback me#imzye.com, replace # with @
- Get latest SRE news and discuss on Discord Channel