Configuring a Bucket Policy

Bucket policies define the access control over resources (buckets and objects) in OBS.

Procedure

  1. Log in to OBS Browser+.

  2. Select the bucket you want and choose More > Bucket Policy. The window shown in Figure 1 is displayed.

    Figure 1 Configuring a bucket policy

    image1

  3. Enter a bucket policy in the following format.

    1. Grant permissions to an account. In the following example, the account (whose account ID is 783fc6652cf246c096ea836694f71855) is granted the permission required to obtain the log management information about bucket logging.bucket3.

      {
          "Statement": [
              {
                  "Sid": "testing",
                  "Effect": "Allow",
                  "Principal": {
                      "ID": [
                          "domain/783fc6652cf246c096ea836694f71855:user/*"
                      ]
                  },
                  "Action": [
                      "GetBucketLogging"
                  ],
                  "Resource": [
                      "logging.bucket3"
                  ]
              }
          ]
      }
      

      Table 1 describes the parameters that you need to manually modify in the example above:

      Table 1 Parameter changes

      Item to Modify

      Description

      GetBucketLogging

      Value of the Action field that indicates all OBS-supported actions in the policy. The value is a case-insensitive string. The value can contain a wildcard character (*), for example, "Action":["List*", "Get*"], to apply all actions to the resources. You need to change the value as needed.

      Allow

      Value of the Effect field that indicates whether the permission in the policy is allowed or denied. The value must be Allow or Deny.

      logging.bucket3

      The bucket on which the policy works. You can change the bucket name as needed.

      783fc6652cf246c096ea836694f71855

      ID of an account. You can change it as needed. You can obtain the account ID on the bucket's Basic Information page.

    2. Grant permissions to an IAM user. In the following example, the user (whose ID is 71f3901173514e6988115ea2c26d1999) under the account (whose ID is 219d520ceac84c5a98b237431a2cf4c2) is assigned the permission required to set log management for bucket logging.bucket3.

      {
          "Statement": [
              {
                  "Sid": "testing",
                  "Effect": "Allow",
                  "Principal": {
                      "ID": [
                          "domain/219d520ceac84c5a98b237431a2cf4c2:user/71f3901173514e6988115ea2c26d1999"
                      ]
                  },
                  "Action": [
                      "PutBucketLogging"
                  ],
                  "Resource": [
                      "logging.bucket3"
                  ]
              }
          ]
      }
      

      Table 2 describes the parameters that you need to manually modify in the example above:

      Table 2 Parameter changes

      Item to Modify

      Description

      PutBucketLogging

      Value of the Action field that indicates all OBS-supported actions in the policy. The value is a case-insensitive string. The value can contain a wildcard character (*), for example, "Action":["List*", "Get*"], to apply all actions to the resources. You need to change the value as needed.

      Allow

      Value of the Effect field that indicates whether the permission in the policy is allowed or denied. The value must be Allow or Deny.

      logging.bucket3

      The bucket on which the policy works. You can change the bucket name as needed.

      219d520ceac84c5a98b237431a2cf4c2

      ID of an account. You can change it as needed. You can click image3 next to the target bucket to obtain the Account ID on the Basic Information page.

      71f3901173514e6988115ea2c26d1999

      ID of a user under the account. You can change it as needed. You can choose My Credentials from the username in the upper right corner of OBS Console to obtain the IAM User ID.

    For details about the fields in a bucket policy, see Bucket Policy Overview.