Limiting the Time When Objects in a Bucket Are Accessible
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
- En el panel de navegación de OBS Console, elija Object Storage.
- En la lista de bucket, haga clic en el nombre del bucket que desee. Se muestra la página Objects.
- In the navigation pane, choose Permissions > Bucket Policy.
- Click Create.
- In the first row of the template list, click Create Custom Policy on the right.
- Configure parameters listed in the table below.
Tabla 1 Limiting the time when objects in a bucket are accessible 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.
NOTA:This example only grants permissions for resources in the bucket. If you also want to grant permission for the bucket (for example, the permission to list objects in the bucket), create another custom bucket policy.
Actions
- Select * (indicating all actions).
- Operation Strategy: Include selected actions.
NOTA:Selecting * may cause resources to be deleted. To avoid this risk, select Get* that indicates all read permissions.
Conditions
- Condition 1:
- Condition Operator: DateGreaterThan
- Key: CurrentTime
- Value: 2019-03-26T12:00:00Z (UTC format)
- Condition 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.
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.