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.
    To start Cloud Shell, use one of the following methods:
    • 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 as a standalone application

      Enter https://shell.aliyun.com in the address bar of a browser.

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

    Note When you connect to Cloud Shell for the first time, a virtual machine (VM) is created. The creation process takes at most 30 seconds. If you open multiple Cloud Shell windows, all the windows are connected to the same VM. The number of VMs 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 describes all commands of Alibaba Cloud CLI.

    CommandDescription
    getallpartsizeQueries the size of each part of incomplete multipart upload tasks in a bucket and the total size of these parts.
    appendfromfileUploads a local file to an append object in OSS by using append upload.
    corsAdds cross-origin resource sharing (CORS) configurations to a bucket, or modifies, queries, and deletes the CORS configurations of a bucket.
    bucket-encryptionAdds encryption configurations to a bucket, or modifies, queries, and deletes the encryption configurations of a bucket.
    lifecycleAdds lifecycle rule configurations to a bucket, or modifies, queries, and deletes the lifecycle rule configurations of a bucket.
    loggingAdds logging configurations to a bucket, or modifies, queries, and deletes the logging configurations of a bucket.
    bucket-policyAdds bucket policy configurations to a bucket, or modifies, queries, and deletes the bucket policy configurations of a bucket.
    refererAdds hotlink protection configurations to a bucket, or modifies, queries, and deletes the hotlink protection configurations of a bucket.
    bucket-taggingAdds tagging configurations to a bucket, or modifies, queries, and deletes the tagging configurations of a bucket.
    websiteAdds static website hosting, redirection, or back-to-origin configurations to a bucket, or modifies, queries, and deletes the static website hosting, redirection, or back-to-origin configurations of a bucket.
    catExports object content to stdout.
    cors-optionsTests whether a bucket allows a specified cross-origin request.
    cpUploads, downloads, or copies objects.
    create-symlinkCreates a symbolic link.
    duObtains the capacity of a bucket or the size of a specified directory.
    hashCalculates the CRC-64 or MD5 value of a local file.
    helpQueries the help information about a command. We recommend that you run the help command to query the information about how to run a specified command.
    listpartLists the parts generated in an incomplete multipart upload task initiated for an object.
    lsLists buckets, objects, or parts.
    mbCreates a bucket.
    mkdirCreates a directory in a bucket. In OSS, directory names are suffixed with a forward slash (/).
    object-taggingAdds tagging configurations to a bucket, or modifies, queries, and deletes the tagging configurations of an object.
    probeMonitors access to OSS. You can also run this command to troubleshoot issues that are caused by network faults or invalid parameter settings during the upload and download process.
    read-symlinkReads the description of a symbolic link.
    request-paymentConfigures the pay-by-requester mode for a bucket or queries the pay-by-requester configurations of a bucket.
    restoreRestores an object from the frozen state to the readable state.
    rmDeletes buckets, objects, or parts.
    set-aclConfigures the access control list (ACL) for a bucket or an object.
    set-metaConfigures the metadata of an uploaded object.
    signGenerates a signed download URL for an object.
    statObtains the description of a specified bucket or object.
  3. Optional:Run the aliyun oss help command to query the help information about the commands that you can use in Alibaba Cloud CLI to manage OSS data.
    To obtain the help information about a specific command, use the following syntax:
    aliyun oss [command] help

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

    aliyun oss mkdir help