Updated on 2024-03-04 GMT+08:00

Accessing OBS Using a Temporary URL

You can use a temporary URL to access OBS and perform operations such as bucket creation or object upload and download. For details, see Using a URL for Authorized Access. This section describes how to share objects using a temporary URL.

Sharing Objects

You can share objects (files or folders) stored in OBS with all users within a specified period.

Sharing a file

File sharing is temporary. All shared URLs are temporary with a validity period.

A temporary URL consists of the access domain name and the temporary authentication information of a file. Example:

https://bucketname.obs.cn-north-4.myhuaweicloud.com:443/image.png?AccessKeyId=xxx&Expires=xxx&response-content-disposition=xxx&x-obs-security-token=xxx&Signature=xxx

The temporary authentication information contains the AccessKeyId, Expires, x-obs-security-token, and Signature parameters. The AccessKeyId, x-obs-security-token, and Signature parameters are used for authentication. The Expires parameter specifies the validity period of the authentication. For details about the temporary authentication method and parameters, see Authentication of Signature in a URL in Object Storage Service API Reference. A temporary URL also contains the response-content-disposition parameter that defines whether an object is directly downloaded or previewed in a browser when it is accessed. This is determined by the browser based on the Content-Type of the shared object.

After an object is shared through OBS Console, the system will generate a URL that contains the temporary authentication information, valid for five minutes since its generation by default. Each time when you change the validity period of a URL, OBS obtains the authentication information again to generate a new URL for sharing, which takes effect since the time when the validity period is changed.

Sharing a folder

Folder sharing is temporary and has a validity period. Folders can be temporarily shared by access code or URL:

  • By access code: Specify a six-digit access code before creating a sharing task. After the sharing task is created, OBS aggregates the download links of all objects in the folder to a static website that is hosted by a public OBS bucket. Then anyone who has the created temporary URL and access code can access the static website and download the shared files.
  • By URL: Specify a validity period and then share the generated link with others. Anyone can use a signature to access all objects in the shared folder.

Limitations and Constraints

  • A file or folder shared through OBS Console is valid for one minute to 18 hours. If you need a longer validity period for a shared file or folder, use the client tool OBS Browser+ that allows a validity period of up to one year. If you want the shared file or folder to be permanently accessed, use a bucket policy to grant all accounts the read permission for it.
  • Only buckets 3.0 support file and folder sharing. You can view the bucket version in the Basic Information area on the Overview page of a bucket.
  • With file sharing, objects in the Archive or Deep Archive storage class can be shared only after they have been restored. With folder sharing, objects in the Archive or Deep Archive storage class must be restored in their original bucket before they are shared, so that users whom the objects are shared with can download them.

Configuration Procedure

For details about how to share files and folders, see Temporarily Sharing Objects with All Accounts.