×
Community Blog Using Cloud Shell on Alibaba Cloud

Using Cloud Shell on Alibaba Cloud

This article describes how to use Cloud Shell on Alibaba Cloud.

By Justin Cook and Pablo Puig

What Is Cloud Shell?

Before we can begin, we must understand what Alibaba Cloud Cloud Shell is and how it is integrated into the Alibaba Cloud ecosystem. This administration tool is a web-based command line interface that allows users to manage all Alibaba Cloud resources. When you open Cloud Shell, you will get a Linux machine allocated behind the scenes by Alibaba Cloud free of charge. The Linux box is pre-installed with all the necessary packages, including CLI, SSH, VIM, Terraform, and numerous management tools, to communicate with Alibaba Cloud resources and execute maintenance tasks across your entire cloud landscape.

Cloud Shell is user-specific, meaning it adheres to security control policies for permissions of each session and the session's connection to resources. You can also maintain multiple sessions simultaneously to run commands in tandem. You can use the CLI to call cloud service APIs. You can also upload a script to call multiple APIs.

Using Cloud Shell

The following step-by-step guide explains how to use Cloud Shell on Alibaba Cloud.

Opening a Cloud Shell Terminal

  • Step 1: Log in to your Alibaba Cloud account and go to Cloud Shell in a web browser or open Cloud Shell from the OpenAPI Explorer:

1

  • Step 2: After a few seconds, a command line terminal will open on the bottom of your screen:

2

Configuring your Cloud Shell Terminal

Cloud Shell provides multiple configurations and features you can use to adjust to your convenience. We will explain the most important ones.

Restart Your Terminal

You can restart your terminal with just one click:

3

Adjust the Text Size and Font

Adjust the text size and font with your preferred configuration:

4

Download and Upload Your Code

You can download and upload your code:

5

Mount and Unmount File Storage

Each VM is given 10GB of temporary storage space allocated to the Linux instance upon creation/login. This is wiped when the instance is deleted. You can mount a File Storage or mount an existing drive if you need more space or want a more permanent storage model.

6

Help Command

If you would like to learn more about Cloud Shell, you can run the command help:

7

Aliyun Command

If you would like to learn more about the Alibaba Cloud Command Line Interface (CLI), you can run the command aliyun:

8

Session Timeout

Cloud Shell logs out automatically after 30 minutes of inactivity, so please pay attention to your session time. You can exit by typing exit or closing the browser, but the VM is released after you log out after 15 minutes. After that time, if you log back in, you will get a new VM.

Using the Command Line Interface (CLI)

The Alibaba Cloud product APIs are divided into RPC API and RESTful API.

Calling an RPC API

Use the following syntax to call an RPC API in the Cloud Shell:

aliyun <product> <ApiName> [--parameter1 value1 --parameter2 value2 ...]

Example: Describe an attribute of a specific RDS instance

aliyun rds DescribeDBInstanceAttribute --DBInstanceId xxxxxx

Call a RESTful API

The calling method of RESTful APIs is different from RPC APIs. The request structure when calling RESTful APIs in the Cloud Shell is listed below:

aliyun <product> [GET|PUT|POST|DELETE] <path>

GET Method

The GET method request structure is listed below:

aliyun <ProductCode> GET /<Resource>

Example: Reading clusters of a Container Service

aliyun cs GET /clusters

POST Method

The POST method request structure is listed below:

aliyun <ProductCode> POST /<Resource> --body "$(cat input.json)"

Example: Uploading a JSON file to a cluster of a Container Service

aliyun cs POST /clusters/ce2cdc26227e09c864d0ca0b2d5/attach --header "Content-Type=application/json" --body "$(cat attach.json)"

DELETE Method

The DELETE method request structure is listed below:

aliyun <ProductCode> DELETE /<Resource>

Example: Deleting a cluster of a Container Service

aliyun cs DELETE /clusters/ce2cdc26227e09c864d0ca0b2d5

0 0 0
Share on

Alibaba Cloud Community

864 posts | 196 followers

You may also like

Comments

Alibaba Cloud Community

864 posts | 196 followers

Related Products