All Products
Search
Document Center

Object Storage Service:put-access-point-public-access-block

Last Updated:Mar 12, 2025

The put-access-point-public-access-block command is used to configure Block Bublic access for an access point.

Note

By default, an Alibaba Cloud account has the permissions to configure block public access for an access point. Configuring as a RAM user or by using Security Token Service (STS) requires the oss:PutAccessPointPublicAccessBlock permission. For details, see Grant custom policy to RAM users.

Syntax

ossutil api put-access-point-public-access-block --bucket value --access-point-name value --public-access-block-configuration value [flags]

Parameter

Type

Description

--bucket

string

The name of the bucket.

--access-point-name

string

The name of the access point.

--public-access-block-configuration

string

Public access blocking configurations for the access point.

Note

The put-access-point-public-access-block command corresponds to the PutAccessPointPublicAccessBlock operation. For information about the parameters within, see PutAccessPointPublicAccessBlock.

--public-access-block-configuration

The --public-access-block-configuration option supports both XML and JSON formats. If the value of the option contains the 'file://' prefix, configuration parameters are read from the specified file.

  • XML format:

    <PublicAccessBlockConfiguration>
      <BlockPublicAccess>true</BlockPublicAccess>
    </PublicAccessBlockConfiguration>
  • JSON format:

    {
      "BlockPublicAccess": "string"
    }
Note

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

Examples

Enable Block Public Access settings for the access point named ap-01 associated with examplebucket.

  • Create a configuration file named public-access-block-configuration.xml and add the following code:

    <?xml version="1.0" encoding="UTF-8"?>
    <PublicAccessBlockConfiguration>
      <BlockPublicAccess>true</BlockPublicAccess>
    </PublicAccessBlockConfiguration>

Sample command:

ossutil api put-access-point-public-access-block --bucket examplebucket --access-point-name ap-01 --public-access-block-configuration file://public-access-block-configuration.xml
  • Create a configuration file named public-access-block-configuration.json and add the following code:

    {
      "BlockPublicAccess": "true"
    }

    Sample command:

    ossutil api put-access-point-public-access-block --bucket examplebucket --access-point-name ap-01 --public-access-block-configuration file://public-access-block-configuration.json
  • Configure parameters in the following command in the JSON format:

    ossutil api put-access-point-public-access-block --bucket examplebucket --access-point-name ap-01 --public-access-block-configuration "{\"BlockPublicAccess\":\"true\"}"