Help Center/ Object Storage Service/ obsutil/ Bucket Commands/ Configuring a Bucket Policy
Updated on 2023-03-21 GMT+08:00

Configuring a Bucket Policy

Function

You can use this command to configure a bucket policy.

Command Line Structure

  • In Windows
    obsutil bucketpolicy obs://bucket -method=put -localfile=xxx [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
  • In Linux or macOS
    ./obsutil bucketpolicy obs://bucket -method=put -localfile=xxx [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]

Examples

  • Take the Windows OS as an example. Run the obsutil bucketpolicy obs://bucket -method=put -localfile=d:\temp\policy.json command to set a bucket policy based on file policy.json.
    obsutil bucketpolicy obs://bucket -method=put -localfile=d:\temp\policy.json
    
    Put bucketPolicy succeed, requestId is [04050000016836C5DA6FB21F14A2A0C0]

Parameter Description

Parameter

Optional or Mandatory

Description

bucket

Mandatory

Bucket name

method

Mandatory

Specifies the method. Set this parameter to put when configuring a bucket policy.

localfile

Mandatory

Path of the local policy file to import

config

Optional (additional parameter)

User-defined configuration file for executing a command. For details about parameters that can be configured, see Parameter Description.

e

Optional (additional parameter)

Specifies the endpoint.

i

Optional (additional parameter)

Specifies the user's AK.

k

Optional (additional parameter)

Specifies the user's SK.

t

Optional (additional parameter)

Specifies the user's security token.