Creating a Custom Bucket Policy (JSON View)

If you are familiar with the JSON syntax and OBS bucket policies, you can code a bucket policy in the JSON view. There is no limit on the number of bucket policies (statements) for a bucket. However, the total size of JSON descriptions of all bucket policies in a bucket cannot exceed 20 KB.

Procedure

  1. In the navigation pane on the left of OBS Console, choose Object Storage.
  2. In the bucket list, click a bucket name, and then the Overview page of the bucket is displayed.
  3. In the navigation pane on the left, click Permissions > Bucket Policy.
  4. In the upper right corner of the page, select JSON and click Edit Bucket Policy.
  5. The following is an example policy edited in JSON:

    {
       "Statement":[
           {
               "Action":[
                   "CreateBucket",
                   "DeleteBucket"
               ],
               "Effect":"Allow",
               "Principal":{
                   "ID":[
                       "domain/account ID", 
                       "domain/account ID:user/User ID" 
                   ]
               },
               "Condition":{
                   "NumericNotEquals":{
                       "Referer":"sdf"
                   },
                   "StringNotLike":{
                       "Delimiter":"ouio"
                   }
               },
               "Resource":"000-02/key01"
           }
       ]
     }

    Table 1 Parameter description

    Parameter

    Description

    Action

    Actions on which the bucket policy takes effect. For details, see Policy Format.

    Effect

    For details about bucket policy effects, see Policy Format.

    Principal

    Authorized users on whom the bucket policy takes effect. You can obtain the user ID on the My Credential page by logging in to the console as the user to be authorized. Principal format:

    • "domain/account ID" (when the principal is an account)
    • "domain/account ID:user/User ID" (when the principal is a user under an account)

    Condition

    Conditions under which the bucket policy takes effect. For details, see Policy Format.

    Resource

    Resources on which the bucket policy takes effect. For details, see Policy Format.

  6. Click Save.