All Products
Search
Document Center

Object Storage Service:presign (generate presigned URL)

Last Updated:May 15, 2025

You can run the presign command to generate a presigned URL.

Command syntax

ossutil presign oss://bucket[/prefix] [flags]

Parameter

Type

Description

-d, --dirs

/

Returns objects and subdirectories in the current directory, instead of recursively displaying all objects in all subdirectories.

--encoding-type

string

The encoding method used to encode the object name. Valid value: url.

--end-with

string

Returns objects whose names are alphabetically before or the same as the value of the --end-with parameter.

--exclude

stringArray

The exclusion rule for paths or object names.

--exclude-from

stringArray

Reads the exclusion rule from a file.

--expires-date

Time

The point in time at which the signed URL expires.

--expires-duration

Duration

The validity period of the signed URL. The validity period ranges from 1 second to 1 week. Default value: 15m0s.

--files-from

stringArray

Reads a list of source object names from a file, with empty lines and comment lines ignored.

--files-from-raw

stringArray

Reads a list of source objects from a file.

--filter

stringArray

The filter rule for paths or object names.

--filter-from

stringArray

Reads filter rules from a file.

-f, --force

/

Forces the operation without requiring user confirmation.

--include

stringArray

The inclusion rule for paths or object names.

--include-from

stringArray

Reads the inclusion rule from a file.

--limited-num

int

The maximum number of results to return.

--list-objects

/

Lists objects by calling the ListObjects operation.

--min-age

Duration

Processes only files that were modified before the specified time interval. The default unit is seconds. You can use a unit suffix. For example, 1h indicates one hour.

Note

--min-age 1h indicates that only files that were modified at least 1 hour ago are processed.

--max-age

Duration

Processes only files that were modified within the specified time interval. The default unit is seconds. You can use a unit suffix. For example, 1h indicates one hour.

Note

--max-age 1h indicates that only files that were modified within the last hour are processed.

--min-mtime

Time

Processes only files that were modified after the specified time. Time format: UTC. Example: 2006-01-02T15:04:05.

Note

--min-mtime "2006-01-02T15:04:05" indicates that only files that were modified after January 2, 2006, 15:04:05 are processed.

--max-mtime

Time

Processes only files that were modified before the specified time. Time format: UTC. Example: 2006-01-02T15:04:05.

--max-size

SizeSuffix

The maximum size of a file or object that can be transferred. By default, the size is in bytes (B). You can suffix the numerical value with a 1024-based unit: B for byte, K for Kibibyte, M for Mebibyte, G for Gibibyte, T for Tebibyte, or P for Pebibyte.

--metadata-exclude

stringArray

The exclusion rule for object metadata.

--metadata-filter

stringArray

The filter rule for object metadata.

--metadata-filter-from

stringArray

Reads the metadata filter rule from a file.

--metadata-include

stringArray

The inclusion rule for object metadata.

--min-size

SizeSuffix

The minimum size of a file or object that can be transferred. By default, the size is in bytes (B). You can suffix the numerical value with a 1024-based unit: B for byte, K for Kibibyte, M for Mebibyte, G for Gibibyte, T for Tebibyte, or P for Pebibyte.

--page-size

int

The maximum number of objects that can be returned per page. Default value: 1000. Valid values: 1 to 1000.

--query-param

stringArray

The query parameters in the request.

-r, --recursive

/

Specifies that command is recursively performed on objects. If this parameter is specified, the command takes effect on all objects that meet the conditions in the bucket. Otherwise, the command takes effect on only the objects in the specified path.

--request-payer

string

The payer of the request. If pay-by-requester is enabled, specify this parameter. Valid value: requester.

--start-after

string

Specifies that objects whose names are alphabetically before or the same as the value of the --end-with parameter are returned.

--traffic-limit

int

The bandwidth limit of a single connection. Valid values: 819200 to 838860800.

--version-id

string

The version ID of the object.

Note

For more information, see Command-line options.

Examples

  • Generate a presigned URL with the default validity period of 15 minutes for the example.txt object in the examplebucket bucket.

    ossutil presign oss://examplebucket/example.txt
  • Generate a presigned URL with a validity period of 1 hour for the example.txt object in the examplebucket bucket.

    ossutil presign oss://examplebucket/example.txt --expires-duration 1h
  • Generate a presigned URL that remains valid until 2024-06-01T12:00:00 (UTC) for the example.txt object in the examplebucket bucket.

    ossutil presign oss://examplebucket/example.txt --expires-date 2024-06-01T12:00:00
  • Generate a presigned URL that contains image processing parameters for the example.txt object in the examplebucket bucket.

    ossutil presign oss://examplebucket/example.txt --query-param x-oss-process=image/resize,m_fixed,w_100,h_100/rotate,90
  • Generate a presigned URL for the "123" version of the example.txt object in the examplebucket bucket.

    ossutil presign oss://examplebucket/example.txt --version-id 123
  • Generate presigned URLs with a validity period of 15 minutes for objects in the "folder" directory in the examplebucket bucket.

    ossutil presign oss://examplebucket/folder/ -r
  • Generate presigned URLs with the default validity period of 15 minutes for TXT objects in the "folder" directory of the examplebucket bucket.

    ossutil presign oss://examplebucket/folder/ -r --include "*.txt"