All Products
Search
Document Center

MaxCompute:Connect by using Cloud Shell (odpscmd)

Last Updated:Aug 14, 2025

MaxCompute provides a cloud-based client environment built on Alibaba Cloud Shell. This lets you use the MaxCompute client (odpscmd) without manual installation. This topic describes usage notes and provides examples of how to use Cloud Shell (odpscmd).

Prerequisites

If you use a Resource Access Management (RAM) user to log on to Cloud Shell (odpscmd) for MaxCompute, ensure that the RAM user has the AliyunCloudShellFullAccess permission. For more information about how to grant permissions, see Resource Access Management.

Limits

Note

Cloud Shell is a web-based command line interface (CLI) tool provided by Alibaba Cloud. MaxCompute uses Cloud Shell to provide a cloud-based client environment. This lets you use the client (odpscmd) without manual installation. For more information, see What is Cloud Shell?.

  • Cloud Shell limits

    Item

    Description

    Number of VMs

    Only one virtual machine (VM) can be created at a time regardless of the number of Cloud Shell sessions that are opened. All opened Cloud Shell sessions are automatically connected to the VM.

    Number of session windows

    A maximum of five sessions can be opened at a time.

    VM destruction on no interaction

    If no interactive operation is performed for 30 minutes or all sessions are closed, the VM is destroyed in 15 minutes. When you restart Cloud Shell, a new VM is created.

    VM destruction on expiration

    A VM created by Cloud Shell is valid for only 1 hour. After the VM expires, Cloud Shell immediately destroys the VM. When you restart Cloud Shell, a new VM is created.

    File storage

    Cloud Shell provides 10 GB of temporary storage. You can store your files in the /home/shell directory. However, the directory is reset when the VM is destroyed. You can choose to mount storage space for storage, which is automatically loaded each time Cloud Shell starts.

    Prohibition

    Long-term use or computing and network-intensive malicious processes are not supported. In these cases, a session may be terminated or even prohibited without warning.

  • Region limits

    You can use Cloud Shell to connect to MaxCompute only in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), and China (Shenzhen).

Precautions

When you start Cloud Shell (odpscmd) for MaxCompute in any region, the Cloud Shell service and temporary storage service are deployed in the China (Shanghai) region by default. If your project is in a different region, this configuration may pose a security risk. Use this feature with caution.

Enter the Cloud Shell (odpscmd) environment

  1. Log on to the MaxCompute console and select a region in the upper-left corner.

  2. On the Workspace > Project Management page, click Command Line in the upper-right corner.

  3. In the Project Selection dialog box, select the project that you want to manage and click OK.

    Note

    If a prompt about mounting a NAS file system appears, you can mount one as needed. For more information, see (Optional) Mount a NAS file system.

    After Cloud Shell (odpscmd) is loaded, the interface appears, as shown in the following figure.image.png

(Optional) Mount a NAS file system

Cloud Shell provides 10 GB of temporary storage space. This space is reset when the virtual machine is destroyed. For persistent storage, you can mount a NAS file system, which is automatically loaded each time Cloud Shell starts. To mount a NAS file system, perform the following steps.

In the MaxCompute Cloud CMD window, click the image.png icon, select Mount Storage Space, and then attach a NAS file system.

Note

Mounting a NAS file system incurs storage fees. After you finish using the file system, detach it promptly. For more information about NAS storage fees, see Billing overview.

Use Cloud Shell (odpscmd)

Cloud Shell (odpscmd) for MaxCompute supports all SQL commands that can be run on a local client. This section provides examples of how to run SQL commands and transfer data using Cloud Shell (odpscmd).

Run SQL commands

To create a table named result_table1, run the following command:

CREATE TABLE IF NOT EXISTS result_table1 (
 education STRING comment 'Education level',
 num BIGINT comment 'Number of people');

After the table is created, run the following command to view it:

SHOW TABLES;

Data transmission

  • Upload a file

    1. Click the image.png icon and select Upload to upload a local file. This topic uses the result.txt file as an example.

      After the upload is complete, press Ctrl+C to exit the Cloud Shell (odpscmd) environment. Then, run the ll command to verify that the file is uploaded and view the file path.

      image.png

      After you confirm that the file is uploaded, run the following command to return to the Cloud Shell (odpscmd) environment:

      cloudshell-odpscmd -p <project.name>
    2. Run the following command to upload the result.txt file to MaxCompute:

      tunnel upload result.txt result_table1;
  • Download a file

    1. Run the following command to download the result_table1 table from MaxCompute to Cloud Shell (odpscmd):

      Tunnel download result_table1 result_table1.txt;
    2. Click the image.png icon and select Download to download the result_table1.txt file to your local computer.

      After the download is complete, the result is shown in the following figure.

      image.png