All Products
Search
Document Center

Object Storage Service:create-symlink

Last Updated:Mar 20, 2026

Use the create-symlink command to create a symbolic link that points to an object in Object Storage Service (OSS). Symbolic links work like shortcuts — they give you quick access to an object without duplicating it.

Prerequisites

Before you begin, make sure you have:

Command syntax

ossutil create-symlink cloud_url target_object
[--encoding-type <value>]
[--payer <value>]
Parameter/OptionDescriptionExample
cloud_urlThe full OSS path of the symbolic link to create.oss://examplebucket/test.jpg
target_objectThe full OSS path of the object the symbolic link points to. The symbolic link and the target object must be in the same bucket.oss://examplebucket/exampleobject.jpg
--encoding-typeThe encoding method for object names in cloud_url and target_object. Valid value: url. If not specified, names are not encoded.url
--payerThe payer for the request. Set to requester to have the requester pay traffic and request fees.requester

Usage notes

  • ossutil does not check whether the target object exists when creating a symbolic link. If the target object exists, the symbolic link points to it. If the target does not exist, the symbolic link points to nothing. To verify the target object exists, run the ls command to list objects in the bucket.

Important

If the symbolic link name matches an existing symbolic link in the bucket, the existing symbolic link is overwritten.

Examples

Create a symbolic link in the root directory

Create a symbolic link named test.jpg in the root of examplebucket, pointing to exampleobject.jpg in the same bucket:

ossutil create-symlink oss://examplebucket/test.jpg oss://examplebucket/exampleobject.jpg

Create a symbolic link in a subdirectory

Create a symbolic link named example.jpg in the destfolder/ directory of examplebucket, pointing to test.jpg in the root of the same bucket. The requester pays all traffic and request fees:

ossutil create-symlink oss://examplebucket/destfolder/example.jpg oss://examplebucket/test.jpg --payer requester

Expected output

A successful operation returns the elapsed time:

0.106744(s) elapsed

Create a symbolic link across accounts or regions

To access a bucket in a different region or owned by a different Alibaba Cloud account, add the -e, -i, and -k options.

The following command creates a symbolic link named testobject.png pointing to exampleobject.png in testbucket, which is located in the China (Shanghai) region and owned by a different account:

ossutil create-symlink oss://testbucket/testobject.png oss://testbucket/exampleobject.png -e oss-cn-shanghai.aliyuncs.com -i yourAccessKeyID -k yourAccessKeySecret
OptionDescription
-eThe endpoint of the region where the bucket is located.
-iThe AccessKey ID of the account that owns the bucket.
-kThe AccessKey secret of the account that owns the bucket.

For all available options, see Common options.

What's next

After creating a symbolic link, run the read-symlink or stat command to query its details, such as the ETag value and last update time.