All Products
Search
Document Center

Object Storage Service:put-bucket-access-monitor

Last Updated:Aug 22, 2024

Enables or disables access tracking for a bucket.

Usage notes

By default, an Alibaba Cloud account has the permissions to enable or disable access tracking for a bucket. To enable or disable access tracking for a bucket by using a RAM user or Security Token Service (STS), you must have the oss:PutBucketAccessMonitor permission. For more information, see Attach a custom policy to a RAM user.

Command syntax

ossutil api put-bucket-access-monitor --bucket value --access-monitor-configuration value [flags]

Parameter

Type

Description

--bucket

string

The name of the bucket.

--access-monitor-configuration

string

The access tracking configurations of the bucket.

Note

The put-bucket-access-monitor command corresponds to the PutBucketAccessMonitor operation. For more information about the parameters in the PutBucketAccessMonitor operation, see PutBucketAccessMonitor.

--access-monitor-configuration

The --access-monitor-configuration option supports both the XML and JSON formats. If the value of the option contains the file:// prefix, ossutil reads configurations from a configuration file.

  • XML format:

    <AccessMonitorConfiguration>
      <Status>string</Status>
    </AccessMonitorConfiguration>
  • JSON format:

    {
      "Status": "string"
    }
Note

For more information about supported global command-line options, see Global command-line options.

Examples

The following examples show how to enable access tracking for a bucket named examplebucket.

  • Create an access-monitor-configuration.xml configuration file and add the following code to the configuration file:

    <?xml version="1.0" encoding="UTF-8"?>
    <AccessMonitorConfiguration>
      <Status>Enabled</Status>
    </AccessMonitorConfiguration>

Sample command:

ossutil api put-bucket-access-monitor --bucket examplebucket --access-monitor-configuration file://access-monitor-configuration.xml
  • Create an access-monitor-configuration.json configuration file and add the following code to the configuration file:

    {
      "Status": "Enabled"
    }

    Sample command:

    ossutil api put-bucket-access-monitor --bucket examplebucket --access-monitor-configuration file://access-monitor-configuration.json
  • Configure parameters in the following command in the JSON format:

    ossutil api put-bucket-access-monitor --bucket examplebucket --access-monitor-configuration "{\"Status\":\"Enabled\"}"