copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2021-03-16 |
events, activity, logging, api |
cloud-object-storage |
{{site.data.keyword.attribute-definition-list}}
{: #quota}
A hard quota sets a maximum amount of storage (in bytes) available for a bucket. Once reached, the limit prevents adding any additional objects to the bucket until existing objects are moved or deleted to free up space, or the quota is raised. {: shortdesc}
This feature is not currently supported in {{site.data.keyword.cos_short}} for {{site.data.keyword.satelliteshort}}. Learn more. {: note}
There are two types of usage quota: a "hard" quota described above, and a "soft" quota that alerts a user that usage has crossed a threshold, but does not prevent any further object writes. To configure a soft quota, make use of {{site.data.keyword.mon_full_notm}} to set usage alerts.
{: #quota-console}
You can use the console to add a hard quota to a bucket during creation, or an existing bucket.
{: #quota-console-new}
- After navigating to your object storage instance, click on Create bucket.
- Under Advanced configurations, look for Quota enforcement and toggle the selector to Enabled.
- Now raise or lower the value and choose the appropriate storage unit. Then, click Save.
- Continue configuring any other rules, setting, or policies on the new bucket.
{: #quota-console-existing}
First, make sure that you have a bucket. If not, follow the getting started tutorial to become familiar with the console.
- Navigate to a bucket, so that you are looking at a list of objects. Select Configuration from the navigational menu.
- Under Advanced configurations, look for Quota enforcement and toggle the selector to Enabled.
- Now raise or lower the value and choose the appropriate storage unit. Then, click Save.
{: #quota-console-disable}
- Navigate to the bucket where you want to change the quota, so that you are looking at a list of objects. Select Configuration from the navigational menu.
- Under Advanced configurations, look for Quota enforcement.
- If you want to disable the quota enforcement, toggle the selector to Disable. Alternatively, keep the quota enforcement enabled, but edit the values as needed.
- Click Save.
{: #at-api}
Bucket quotas are managed with the COS Resource Configuration API.
To add a quota, you send a PATCH
request to edit the bucket's metadata:
curl -X PATCH https://config.cloud-object-storage.cloud.ibm.com/v1/b/my-bucket \
-H 'authorization: bearer $IAM_TOKEN' \
-d '{"hard_quota": 10000000000}'
To disable the quota, set it to zero:
curl -X PATCH https://config.cloud-object-storage.cloud.ibm.com/v1/b/my-bucket \
-H 'authorization: bearer $IAM_TOKEN' \
-d '{"hard_quota": 0}'
To temporarily disable writing new data to the bucket, set the quota to a very small integer:
curl -X PATCH https://config.cloud-object-storage.cloud.ibm.com/v1/b/my-bucket \
-H 'authorization: bearer $IAM_TOKEN' \
-d '{"hard_quota": 1}'
To check the quota on a bucket, send a GET request to view the hard_quota
field in the bucket's metadata:
curl https://config.cloud-object-storage.cloud.ibm.com/v1/b/my-bucket \
-H 'authorization: bearer $IAM_TOKEN'