Alibaba Cloud Shell integrates all features of ossutil, which is a command line tool provided to manage data in Object Storage Service (OSS). You can use the syntax of Alibaba Cloud Command Line Interface (CLI) to manage your data in OSS.

Background information

You can use Alibaba Cloud CLI to manage the following OSS data:
  • Buckets. For example, you can create, query, and delete OSS buckets.
  • Objects. For example, you can upload, download, query, copy, and delete OSS objects.
  • Parts. For example, you can query and delete OSS parts.

Procedure

  1. Start Cloud Shell.
    Use one of the following methods to start Cloud Shell:
    • Start Cloud Shell in the Alibaba Cloud Management console.

      In the Alibaba Cloud Management console, click the Cloud Shell icon in the top navigation bar.

    • Start Cloud Shell in a browser or in OpenAPI Explorer.

      Enter https://shell.aliyun.com in the address bar of a browser or go to the Online Linux Shell tab in OpenAPI Explorer.

      You can open up to five Cloud Shell windows at the same time.

    Note When you connect to Cloud Shell the first time, a virtual machine is created for you. This operation takes at most 30 seconds. If you open multiple Cloud Shell windows, all the windows connect to the same virtual machine. The number of virtual machines does not increase when you open a new Cloud Shell window.
  2. Use Alibaba Cloud CLI to manage data in OSS.

    Cloud Shell is authorized to access your OSS service. You can use Alibaba Cloud CLI to manage data in OSS without the need to install other tools or configure other settings.

    Basic syntax:

    aliyun oss [command] [options and parameters]
    Examples:
    • Run the following command to create a bucket:
      aliyun oss mb oss://vmeixme
    • Run the following command to create a directory in a bucket:
      aliyun oss mkdir oss://vmeixme/horse/
    • Run the following command to query all buckets, objects, and parts in OSS:
      aliyun oss ls

    The following table lists all commands of Alibaba Cloud CLI.

    Command Description
    getallpartsize Queries the size of each part in a bucket that has not been uploaded and the total size of all of those parts.
    appendfromfile Uploads a local file to an append object in OSS by using append upload.
    cors Adds, modifies, queries, or deletes cross-origin resource sharing (CORS) configurations for a bucket.
    bucket-encryption Adds, modifies, queries, or deletes encryption configurations for a bucket.
    lifecycle Adds, modifies, queries, or deletes lifecycle rule configurations for a bucket.
    logging Adds, modifies, queries, or deletes logging configurations for a bucket.
    bucket-policy Adds, modifies, queries, or deletes bucket policy configurations for a bucket.
    referer Adds, modifies, queries, or deletes hotlink protection configurations for a bucket.
    bucket-tagging Adds, modifies, queries, or deletes tagging configurations for a bucket.
    website Adds, modifies, queries, or deletes static website hosting, redirection, and back-to-origin configurations for a bucket.
    cat Exports object content to stdout.
    cors-options Tests whether a bucket allows a specified CORS request.
    cp Uploads, downloads, or copies objects.
    create-symlink Creates a symbolic link.
    du Obtains the capacity of a bucket or the size of a specified directory.
    hash Calculates the CRC-64 or MD5 value of a local file.
    help Queries help information about a command. We recommend that you use the help command to query information about a specified command.
    listpart Queries the parts that are not uploaded for an object.
    ls Queries buckets, objects, or parts.
    mb Creates a bucket.
    mkdir Creates a directory in a bucket. In OSS, directory names are suffixed with a forward slash (/).
    object-tagging Adds, modifies, queries, or deletes tagging configurations for an object.
    probe Monitors access to OSS. This command can also be used to troubleshoot issues that are caused by network faults or invalid parameter settings during the upload or download process.
    read-symlink Reads the description of a symbolic link object.
    request-payment Configures or queries pay-by-requester configurations for a bucket.
    restore Restores an object from the frozen state to the readable state.
    rm Deletes buckets, objects, or parts.
    set-acl Configures the access control list (ACL) for a bucket or an object.
    set-meta Configures the metadata for an uploaded object.
    sign Generates a signed download URL for an object.
    stat Queries the description of a specified bucket or object.
  3. Optional:Run the aliyun oss help command to query help information of commands that you can use in Alibaba Cloud CLI to manage OSS data.
    To query help information of a specified command, use the following syntax:
    aliyun oss [command] help

    For example, to query help information of the command used to create a directory in a bucket, run the following command:

    aliyun oss mkdir help