From 72584c15bc36fb890a727ac2faf296becc43524e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 21 Jan 2022 02:55:36 -0800 Subject: [PATCH] Created S3 Bucket Quota (markdown) --- S3-Bucket-Quota.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 S3-Bucket-Quota.md 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