Updated on 2024-12-11 GMT+08:00

Obtaining a Bucket Policy

Function

You can use this command to obtain a bucket policy.

Command Line Structure

  • In Windows
    obsutil bucketpolicy obs://bucket -method=get [-localfile=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
  • In Linux or macOS
    ./obsutil bucketpolicy obs://bucket -method=get [-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=get -localfile=d:\temp\policy.json command to export the bucket policy to local file policy.json.
    obsutil bucketpolicy obs://bucket -method=get -localfile=d:\temp\policy.json
    
    Start at 2024-09-30 08:08:59.9412332 +0000 UTC
    
    Export bucketPolicy to [d:\temp\policy.json] succeed, requestId is [04050000016836C5DA6FB21F14A2A0C0]

Parameter Description

Parameter

Optional or Mandatory

Description

bucket

Mandatory

Bucket name

method

Mandatory

Specifies the method. Set this parameter to get when obtaining a bucket policy.

localfile

Optional (additional parameter)

If this parameter is set, the policy is exported to a local file. If not set, the policy is exported in a standard manner by default.

config

Optional (additional parameter)

User-defined configuration file for executing the current command. To learn the parameters that can be configured in this file, see Configuration Parameters.

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.