Baking Clouds Ltd

Baking Clouds provide tailored IT consultancy services to small and medium-sized companies; we cover all aspects of IT without any hidden costs.

Create Alibaba storage buckets from the cloud shell using ossutil

The purpose of this blog post is to show you the basic commands you can run to manage your Alibaba buckets using ossutil command tool from cloud shell. But there more things you can with cloud shell, such as develop, build, debug and even deploy your apps! We invite you to visit Alibaba Cloud to explore all possibilities.

About Alibaba Cloud Shell

The Alibaba Cloud Shell is a management tool built on Alibaba Cloud’s open APIs. Users can utilize this tool to control their Alibaba Cloud services by calling open APIs provided by Alibaba Cloud. To expand the functionality, users can attach the Cloud Shell to Alibaba Cloud’s built-in APIs.

Important: At the moment, the Cloud Shell is free, however, if you need to use permanent storage, you need to pay for storage fees based on your actual usage.

Cloud Shell provides:

  • An ephemeral machine to use as a host for a Linux shell, pre-configured with cloud management tools and system tools, including Python, Java, Node.js, Alibaba Cloud CLI, cURL, SSH, Kubectl, Fun, Terraform, Ansible, and Vim
  • Permanent disk storage for your home directory
  • A persistent frame of the Console which stays active as you navigate to different pages of the console
  • Built-in Code Editor. ou can directly develop applications online and run or deploy scripts through command lines. You can also bind a storage space to Cloud Shell to permanently store the edited files.

Create Storage Bucket from Cloud Shell

Start Cloud Shell

To launch Cloud Shell, select one of the options below.

  • Start from Alibaba Cloud console Click the Cloud Shell icon in the top menu of the Alibaba Cloud console to start Cloud Shell.
  • Start from web browser Enter in a web browser or open Cloud Shell from the OpenAPI Explorer. You can start multiple Cloud Shell windows as needed, but up to 5 Cloud Shell windows can be started at the same time.

Use OSSUTIL from cloud shell

In the Cloud Shell, you can manage OSS data with ossutil commands. ossutil allows you to perform the following operations:

  • Manage buckets, such as create, list, and delete buckets.
  • Manage objects, such as upload, download, list, copy, and delete objects.
  • Manage parts, such as list and delete parts.

Install ossutil

Download the ossutil installation package:


Modify the execution permissions of the file:

chmod 755 ossutil64

Generate a configuration file in interactive mode

./ossutil64 config

Configure the path of the configuration file as prompted, we decided to use the default path.

Set the language of ossutil as prompted

Configure the parameters, including endpoint, AccessKey ID, AccessKey secret, and Security Token Service (STS) token

Now that we have installed and configured ossutil it’s time to run some commands to work with buckets

Create storage bucket

Command syntax

./ossutil64 mb oss://bucket_name [--acl <value>][--storage-class <value>][--redundancy-type <value>]

As example we are creating a private bucket in Sydney region, storage class standard

./ossutil64 mb oss://bakingclouds-post --acl private --storage-class Standard --redundancy-type LRS

Uploading Files to Oracle Cloud Storage

To have organized objects when you upload files to a bucket, the best way is to create directories.

Command syntax

./ossutil64 mkdir oss://bucket_name dir_name [--encoding-type <value>]

Single-level directory created in our bucket. No encoding type specified.

./ossutil mkdir oss://bakingclouds-post/Folder/

Multi-level directory

./ossutil mkdir oss://bakingclouds-post/Folder/Multi

You can upload files from local storage or objects from other Cloud Storage buckets. In the following example we are going to download a sample image file to an images directory and then copy the file to our bucket.

shell@Alicloud:~$ mkdir images
shell@Alicloud:~$ curl -o images/alibabacloud.jpg

Upload the file from images directory to your Cloud Storage bucket

Command syntax

./ossutil64 cp filename oss://examplebucket/dir/
./ossutil64 cp filename oss://examplebucket/dir/

As you can see in this post, using the ossutil command tool from cloud shell is very simple.
The Alibaba documentation center has good resources, where you can find more common options, and also other command tools to manage your storage buckets.

We hope you enjoyed this post! If you like it or want us to include more information click the button below to send us your comments. Thanks!!

Reference Links

Alibaba Regions and endpoints

ossutil Alibaba guide

Alibaba Cloud Shell

Create Alibaba storage buckets from the cloud shell using ossutil

One thought on “Create Alibaba storage buckets from the cloud shell using ossutil

Comments are closed.

Scroll to top