Enables or disables access tracking for a bucket. When enabled, OSS records the last access time of objects. You can then configure lifecycle rules based on last access time to identify hot and cold data and move cold data to lower-cost storage classes.
Usage notes
You must have the oss:PutBucketAccessMonitor permission. For more information, see Grant a custom policy.
Request syntax
PUT /?accessmonitor HTTP/1.1
Host: BucketName.oss.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
<?xml version="1.0" encoding="UTF-8"?>
<AccessMonitorConfiguration>
<Status>Enabled</Status>
</AccessMonitorConfiguration>
Request headers
DescribeRegions uses only common request headers. For more information, see Common request headers.
Request elements
|
Element |
Type |
Required |
Example |
Description |
|
AccessMonitorConfiguration |
Container |
Yes |
N/A |
The access tracking configuration of the bucket. Child nodes: Status |
|
Status |
String |
Yes |
Enabled |
Whether to enable access tracking. Valid values:
Parent nodes: AccessMonitorConfiguration |
Response headers
The response contains only common response headers. For more information, see Common response headers.
Examples
Sample request
PUT /?accessmonitor HTTP/1.1
Host: oss-example.oss.aliyuncs.com
Date: Thu, 17 Apr 2025 13:08:38 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
<?xml version="1.0" encoding="UTF-8"?>
<AccessMonitorConfiguration>
<Status>Enabled</Status>
</AccessMonitorConfiguration>
Sample response
HTTP/1.1 200 OK
x-oss-request-id: 5C1B138A109F4E405B2D****
Date: Mon, 26 Jul 2021 13:08:38 GMT
Content-Length: 0
Connection: keep-alive
Server: AliyunOSS
References
-
After enabling access tracking, call PutBucketLifecycle to configure lifecycle rules based on last access time. For more information, see PutBucketLifecycle.
OSS SDKs
The following OSS SDKs support PutBucketAccessMonitor:
ossutil
For the corresponding ossutil command, see put-bucket-access-monitor.
Error codes
|
Error code |
HTTP status code |
Description |
|
MalformedXML |
400 |
The access tracking configuration is invalid. |
|
AccessMonitorDisableNotAllowed |
400 |
The access tracking status cannot be set to Disabled because the bucket has a lifecycle rule based on last access time. |
|
AccessDenied |
403 |
You are not authorized to access the bucket. |
|
NoSuchBucket |
404 |
The bucket does not exist. |