All Products
Search
Document Center

MaxCompute:Connect using odpscmd in Cloud Shell

Last Updated:Mar 26, 2026

MaxCompute integrates with Alibaba Cloud Shell to provide a pre-configured odpscmd environment in your browser — no local installation required. Use Cloud Shell to run SQL commands, manage tables, and transfer data directly from the MaxCompute console.

With Cloud Shell, you can:

  • Run any SQL command supported by the local odpscmd client

  • Upload local files to MaxCompute tables

  • Download MaxCompute table data to your local computer

  • Mount a Network Attached Storage (NAS) file system for persistent storage across sessions

Prerequisites

Before you begin, ensure that you have:

  • An Alibaba Cloud account with access to the MaxCompute console

  • (Resource Access Management (RAM) users only) The AliyunCloudShellFullAccess permission. For details, see Authorize RAM users.

Start odpscmd in Cloud Shell

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

  2. On the Projects page, click Command Line in the upper-right corner.

  3. In the Choose Project dialog box, select the project you want to manage and click OK. After Cloud Shell loads, the odpscmd interface appears.

    Note

    If a dialog box about mounting a NAS file system appears, mount one at this point. See (Optional) Mount a NAS file system for instructions.

    image.png

Run SQL commands

Cloud Shell supports all SQL commands available in the local odpscmd client.

To create a table named result_table1:

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

To list tables in the current project:

SHOW TABLES;

Transfer data

Upload a file

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

  2. After the upload completes, press Ctrl+C to exit the odpscmd environment. Run ll to confirm the file is uploaded and note the file path.

    image.png

  3. Return to the odpscmd environment:

    cloudshell-odpscmd -p <project.name>
  4. Upload result.txt to MaxCompute:

    tunnel upload result.txt result_table1;

Download a file

  1. Download the result_table1 table from MaxCompute to Cloud Shell:

    Tunnel download result_table1 result_table1.txt;
  2. Click the image.png icon and select Download to save result_table1.txt to your local computer. After the download completes, the result appears as shown:

    image.png

(Optional) Mount a NAS file system

Cloud Shell provides 10 GB of temporary storage under /home/shell. This storage is reset when the virtual machine is destroyed. To keep files across sessions, mount a NAS file system — it loads automatically every time you start Cloud Shell (one-time setup).

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

Note

Mounting a NAS file system incurs storage fees. Detach the file system when you no longer need it. For pricing details, see Billing overview.

Limitations

Supported regions

Cloud Shell connects to MaxCompute projects in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), and China (Shenzhen).

Usage limits

Resource Limit
Virtual machines One virtual machine at a time, shared across all session windows
Session windows Up to 5 concurrent session windows
Temporary storage 10 GB, mounted at /home/shell. For persistent storage, you can mount a bucket, which is automatically loaded each time you start Cloud Shell.
Prohibited use Compute-intensive or network-intensive long-running tasks

Session lifecycle

Cloud Shell sessions end in two ways:

  • Inactivity: A session stops after 30 minutes of inactivity or when all session windows are closed. The virtual machine is destroyed 15 minutes after the session stops.

  • Expiration: The virtual machine has a maximum lifetime of 1 hour. After 1 hour, Cloud Shell destroys the virtual machine regardless of activity. When you restart Cloud Shell, a new virtual machine is created.

In both cases, the virtual machine is destroyed 15 minutes after the session stops.

For tasks that require more time, install odpscmd locally instead of using Cloud Shell.

Data residency

The Cloud Shell service and its temporary storage are hosted in the China (Shanghai) region. When you connect to a MaxCompute project in a different region, data is transferred cross-region to China (Shanghai) for processing. Verify that this cross-region data transfer complies with your organization's data residency policies before using Cloud Shell with projects in other regions.

What's next