All Products
Search
Document Center

Elastic Compute Service:Workbench Script Library

Last Updated:Dec 01, 2025

The Workbench Script Library is a script management tool that is built into Workbench. You can use it to save frequently used commands or script snippets to the cloud and run them with a single click in any Workbench instance session.

For example, you can run scripts to check the system load, deploy applications, or clean up logs with a single click.

Key advantages include the following:

  • Improve efficiency: For repetitive operations and maintenance (O&M) tasks, you can save long commands as scripts and run them with a single click. This reduces repetitive work and speeds up operations.

  • Standardize operations: Ensure that operations on different instances are consistent and standardized. This helps maintain a consistent environment and reduces issues caused by manual input errors.

  • Convenient management: You can store and manage your personal scripts in a central location. You can also import existing commands directly from Cloud Assistant to reuse your scripts.

Create a script

You can create scripts in the Script Library in two ways.

Create a script directly

  1. Log on to a Linux instance using Workbench or log on to a Windows instance using Workbench.

  2. In the Workbench interface, click image in the navigation pane on the left to open the Script Library.

  3. In the Script Library panel, click image to create a new script.

  4. In the Create Script dialog box, configure the following parameters.

    • Script Name: Enter a clear and descriptive name for the script, such as "Check System Load".

    • Script Type: Select Shell, Bat, or PowerShell based on the scripting language and the operating system of your instance.

    • Script Content: Paste the script code into this area.

    Example of Shell script content (for Linux):

    #!/bin/bash
    # Check system load, memory, and disk usage
    
    echo "========== System Load =========="
    uptime
    
    echo "========== Memory Usage =========="
    free -h
    
    echo "========== Disk Space Usage =========="
    df -h
  5. After you complete the configuration, click Save.

Import a script from Cloud Assistant

If you have already created frequently used commands in Cloud Assistant, you can quickly import them into the Script Library.

  1. In the Script Library panel, click image to import Cloud Assistant commands.

  2. In the command list that appears, select one or more commands to import.

  3. Click Import. The selected commands are added as new scripts.

Run a script

  1. Log on to a Linux instance using Workbench

    For Windows instances, you must log on using Session Manager to run scripts in the PowerShell interface. You cannot run scripts from the Script Library if you connect using a direct terminal connection (RDP).
  2. In the Workbench interface, click image in the navigation pane on the left to open the Script Library, and then find the script that you want to run.

  3. Click image to the right of the target script.

  4. In the Run Script dialog box, click Run, or create a file and run it.

    • Run: This mode simulates manual input by pasting the script content into the current terminal line by line. This mode is suitable for running a simple sequence of independent commands.

    • Create file before running: This mode saves the entire script content as a temporary file on the server and then runs the file. This is the recommended method for running standard scripts.

      To ensure that the script runs as expected, we recommend that you select the Create file before running mode for any multi-line script.

    image

FAQ

  • Why might a script from the Workbench Script Library fail to run?

    • The script type does not match the operating system of the instance.

    • The script contains errors.

    • The current user does not have the required permissions to run the commands in the script.

  • Where is the Script Library saved? Can I still use it if I switch computers?

    Yes, you can. The Script Library is stored in Alibaba Cloud and linked to your Alibaba Cloud account. The library is automatically synchronized for an account and its Resource Access Management (RAM) users. Therefore, you can use the Script Library even if you switch computers.