signurl command is used to get the pre-signed URL of an object, through which the object can be accessed anonymously../coscli signurl cos://<bucket-name>/<key> [flag]
signurl includes the following parameters:Parameter Format | Description | Example |
cos://<bucket-name>/<key> | Specifies the target object in the bucket, which is accessible by using the bucket alias or bucket name configured in the configuration file as detailed in Download and Installation Configuration. If you use the bucket name for access, you also need to include the endpoint flag. | Access with the bucket alias: cos://example-alias/test.txt Access with the bucket name: cos://examplebucket-1250000000/test.txt |
signurl command contains the following optional flags:Flag Abbreviation | Flag Name | Description |
-h | --help | Views the usage of this command. |
-t | --time | Sets the URL expiration time, which is 1000s by default |
None | --simple-output | Enables the simple output mode, with a default value of false. When set to true, only the signature URL is output to simplify the returned result. |
picture.jpg in bucket1 bucket./coscli signurl cos://bucket1/picture.jpg
INFO[2026-02-04 11:36:10] Signed URL:INFO[2026-02-04 11:36:10] https://bucket1-1234124.cos.ap-guangzhou.myqcloud.com/picture.jpg?q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1770176170%3B1770186170&q-key-time=1770176170%3B1770186170&q-header-list=host&q-url-param-list=&q-signature=****************************************
picture.jpg in bucket2 bucket and setting the URL expiration time to 1314s./coscli signurl cos://bucket2/picture.jpg --time 1314
INFO[2026-02-04 11:36:10] Signed URL:INFO[2026-02-04 11:36:10] https://bucket2-1234124.cos.ap-guangzhou.myqcloud.com/picture.jpg?q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1770176170%3B1770186170&q-key-time=1770176170%3B1770186170&q-header-list=host&q-url-param-list=&q-signature=****************************************
./coscli signurl cos://bucket3/picture.jpg --simple-output
https://bucket3-1234124.cos.ap-guangzhou.myqcloud.com/picture.jpg?q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1770176267%3B1770186267&q-key-time=1770176267%3B1770186267&q-header-list=host&q-url-param-list=&q-signature=****************************************
Feedback