Updated on 2022-08-16 GMT+08:00

Configuring a Custom Bucket Policy

If you want to grant special permissions to specific users, you can configure custom bucket policies. If a standard bucket policy conflicts with a custom bucket policy, the authorization priority is given to the custom bucket policy and then the standard bucket policy.

Procedure

  1. In the bucket list, click the bucket you want to operate. The Overview page of the bucket is displayed.
  2. In the navigation pane on the left, click Permissions to go to the permission management page.
  3. On the Bucket Policies tab page, configure a custom bucket policy according to your needs.
  4. Click Create Bucket Policy. Select a proper policy mode as required. Valid values are as follows:

    • Read-only: The authorized user will be granted with the read permission on the bucket and objects. For subsequent operations, see 5.
    • Read and write: The authorized user will be granted with read and write permissions on the bucket and objects. For subsequent operations, see 5.
    • Customized: The authorized user will be granted with customized permissions on the bucket and objects. For detailed configuration, see 6.

    Only one bucket policy mode can be configured at a time.

  5. For the read-only and read and write modes, enter information about the authorized user in the following format and click OK.

    Table 1 Parameters in bucket policies

    Parameter

    Value

    Description

    Principal

    • Include or Exclude
    • Current account or Other account

    Specifies users on whom this bucket policy takes effect.

    • Include: Specifies the user on whom the bucket policy statement takes effect.
    • Exclude: Specifies that on all users except the specified user the bucket policy statement takes effect.

    Resources

    • Include or Exclude
    • Input format:

      Object: object name

      Object set: object name prefix*, *object name suffix, or *

    Indicates the resource that a bucket policy applies to. With the read-only mode and read and write mode, the policy can only apply to objects.

    • Include: Specifies the OBS resources on which the bucket policy statement takes effect.
    • Exclude: Specifies that on all OBS resources except the specified ones the bucket policy statement takes effect.

  6. For the customized mode, set parameters based on the site requirements and click OK.

    Table 2 lists the meaning of each parameter.
    Table 2 Parameters in bucket policies

    Parameter

    Value

    Description

    Effect

    Allow or Deny

    Effect of a bucket policy.

    • Allow: Indicates access requests are allowed, if they match the configurations of this bucket policy.
    • Deny: Indicates access requests are denied, if they match the configurations of this bucket policy.

    Principal

    • Include or Exclude
    • Current account or Other account

    Specifies users on whom this bucket policy takes effect.

    • Include: Specifies the user on whom the bucket policy statement takes effect.
    • Exclude: Specifies that on all users except the specified user the bucket policy statement takes effect.

    Resources

    • Include or Exclude
    • Specific resources:

      Object: object name

      A set of objects: object name prefix*, *object name suffix, or *

    • Entire bucket: The policy applies to the entire bucket.

    Indicates the resource that a bucket policy applies to.

    • Include: Specifies the OBS resources on which the bucket policy statement takes effect.
    • Exclude: Specifies that on all OBS resources except the specified ones the bucket policy statement takes effect.

    Relationship between resource types and actions:

    • When a resource is an object or an object set, only the actions related to the object can be configured.
    • When the resource is a bucket, only the actions related to the bucket can be configured.

    Actions

    • Include or Exclude
    • For details, see Actions.

    Operations stated in the bucket policy.

    • Include: Specifies the actions on which the bucket policy takes effect.
    • Exclude: Specifies that on all actions except the specified ones the bucket policy takes effect.

    Conditions

    • Conditional Operator: For details, see Table 1.
    • Key: For details, see Table 2, Table 3, and Table 4.
    • Value: The entered value is associated with the key.

    Conditions for the policy statement to take effect.