diff --git a/S3-Bucket-Quota.md b/S3-Bucket-Quota.md new file mode 100644 index 0000000..4a17e88 --- /dev/null +++ b/S3-Bucket-Quota.md @@ -0,0 +1,44 @@ +The bucket quota management is implemented by admin scripts in `weed shell`. + +**1. View current bucket usage** + +Here there are 3 buckets created. Each bucket size and file count are listed. The bucket size is the actual disk space used, including replicated copies. + +``` +> s3.bucket.list + b1 size:527971104 file:151 + b2 size:468432 file:6 + b3 size:10280 file:3 +``` + +**2. Set bucket "b1" to a low quota** + +``` +> s3.bucket.quota -name b1 -sizeMB 15 +updated quota for bucket b1 +> s3.bucket.list + b1 size:527971104 file:151 quota:15728640 usage:3356.75% + b2 size:468432 file:6 + b3 size:10280 file:3 +``` + +**3. Enforce the quota, and found it should be set to read only.** + +The filer configuration is changed to read only for this bucket. +Now, when new write request comes in, the filer will just say this is a read only folder. + +``` +> s3.bucket.quota.enforce -apply + b1 size:527971104 quota:15728640 usage:3356.75% + changing bucket b1 to read only! +{ + "locations": [ + { + "locationPrefix": "/buckets/b1/", + "collection": "b1", + "readOnly": true + } + ] +} + +``` \ No newline at end of file