Created S3 Bucket Quota (markdown)

Chris Lu 2022-01-21 02:55:36 -08:00
parent c8a958a74d
commit 72584c15bc

44
S3-Bucket-Quota.md Normal file

@ -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
}
]
}
```