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
- In the navigation pane on the left of OBS Console, choose Object Storage.
- In the bucket list, click a bucket name, and then the Overview page of the bucket is displayed.
- In the navigation pane on the left, choose Permissions > Bucket Policy.
- Click Create.
- In the first row of the template list, click Create Custom Policy on the right.
- Configure the following parameters.
Table 1 Configuring the Start Time and End Time of Access to Objects Parameter
Description
Policy View
Visual editor
Policy Name
Enter a custom name.
Policy Content
Effect
Allow
Principal
- Anonymous user
- User Policy: Include specified users.
Resources
- Resource scope: Object in bucket. Select All objects.
- Resource Policy: Include specified resources.
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 current bucket.
Actions
- Select * (indicating all actions).
- Operation Strategy: Include selected actions.
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 1
- Condition Operator: DateGreaterThan
- Key: CurrentTime
- Value: 2019-03-26T12:00:00Z (UTC format)
- Conditions 2
- Condition Operator: DateLessThan
- Key: CurrentTime
- Value: 2019-03-26T15:00:00Z (UTC format)
- Click Next in the lower right corner to confirm the policy configuration.
- Click Create in the lower right corner of the page to create the bucket policy.
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.
Last Article: Restricting Bucket Access to a Specified Address
Next Article: Authorizing Access Permissions to Anonymous Users
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.