Updated on 2024-08-15 GMT+08:00

Granting All Accounts the Public Read Permission for a Bucket

Scenario

If a bucket needs to be accessed by all accounts, you can configure a bucket policy and bucket ACL to grant the access permission to all accounts. The following uses a bucket policy as an example.

Configuration Precautions

In this case, the preset template Public Read allows all accounts to perform the following actions on a bucket and the objects in it:

  • HeadBucket (to check whether the bucket exists and obtain the bucket metadata)
  • GetBucketLocation (to get the bucket location)
  • GetObject (to obtain object content and metadata)
  • RestoreObject (to restore objects from Archive storage)
  • GetObjectVersion (to obtain the content and metadata of a specified object version)

Procedure

  1. In the navigation pane of OBS Console, choose Buckets.
  2. In the bucket list, click the bucket name you want to go to the Objects page.
  3. In the navigation pane, choose Permissions > Bucket Policies.
  4. On the Bucket Policies page, click Create.
  5. Choose a policy configuration method you like. Visual Editor is used here.
  6. Configure parameters for a bucket policy.

    Figure 1 Configuring bucket policy parameters
    Table 1 Parameters for configuring a bucket policy

    Parameter

    Description

    Policy Name

    Enter a policy name.

    Policy content

    Effect

    Select Allow.

    Principals

    • Select All accounts.

    Resources

    • Select Entire bucket (including the objects in it).

    Actions

    • Choose Use a template.
    • Select Public Read.

  7. Ensure all the configurations are correct and click Create.

Verification

  1. After the permission is set, in the Domain Name Details area of the bucket overview page, locate Access Domain Name. Share the URL of the access domain name over the Internet so that all Internet users can access the bucket.
  2. On the Objects tab page of the bucket, click the target object name and find the object link. Share the object link over the Internet so that all Internet users can access the object.