Help Center/ Object Storage Service/ User Guide (Kuala Lumpur Region)/ OBS Console Operation Guide/ Permission Control/ Application Cases/ Configuring the Start Time and End Time of Access to Objects in a Bucket
Updated on 2022-08-16 GMT+08:00

Configuring the Start Time and End Time of Access to Objects in a Bucket

You can configure the bucket policy to limit the time when objects in a bucket are accessible. In the following example, the access time window is from 2019-03-26T12:00:00Z to 2019-03-26T15:00:00Z.

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. Choose Bucket Policies > Custom Bucket Policies.
  4. Click Create Bucket Policy. The Create Bucket Policy dialog box is displayed.
  5. Configure the parameters according to the following table:

    Table 1 Parameters for authorizing the permission to access a specified bucket

    Parameter

    Value

    Policy Mode

    Customized

    Effect

    Allow

    Principal

    • Include
    • Select Other account, and enter an asterisk (*) as the account ID, indicating all anonymous users.

    Resources

    • Choose Include > Specific resources.
    • Set the resource name to *, indicating all resources in the bucket.
    NOTE:

    In this example, the policy configures permissions only for resources in the bucket. If you need to configure permissions for the entire bucket (for example, the permission to list objects in the bucket), you need to create another custom bucket policy for the entire bucket.

    Actions

    • Include
    • Select * as the action name, which indicates all action permissions.
    NOTE:

    Selecting all action permissions may cause resources to be deleted. To avoid this risk, you are advised to set the action name to Get*, indicating all read permissions.

    Conditions

    • Condition Operator: DateGreaterThan
    • Key: CurrentTime
    • Value: 2019-03-26T12:00:00Z (UTC format)

    Conditions

    • Condition Operator: DateLessThan
    • Key: CurrentTime
    • Value: 2019-03-26T15:00:00Z (UTC format)

    The preceding two conditions must be configured in the same bucket policy.

  6. Click OK.

Verification

During the specified time period, any user can access the specified resources in the bucket. Outside the specified time period, only the bucket owner can access the bucket.