The Workbench Script Library is a script management tool built into Workbench. It lets you save frequently used commands or script snippets to the cloud and run them with a single click in any instance session connected through Workbench.
For example, you can run scripts with a single click to check system load, deploy applications, or clean up logs.
Key advantages include:
-
Increase efficiency: Eliminate the need to manually type long commands for repetitive tasks. Save them as scripts and run them with a single click, reducing manual effort and speeding up your workflow.
-
Standardize operations: Ensure consistent and standardized execution of tasks across different instances. This maintains a consistent environment and reduces production issues caused by manual errors.
-
Simplify management: Store and manage your personal scripts in a centralized location. You can also import existing commands from Cloud Assistant to reuse them.
Create a script
You can create scripts in the Script Library in two ways.
Create from scratch
-
Log on to a Linux instance using Workbench or log on to a Windows instance using Workbench.
-
In the navigation pane of Workbench, click
to open the Script Library. -
In the Script Library panel, click
to create a new script. -
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: Based on the operating system of your instance and the script language, select
Shell,Bat, orPowerShell. -
Script Content: Paste your script code into this field.
Example of a Shell script (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 -
-
Click Save.
Import from Cloud Assistant
If you have already created frequently used commands in Cloud Assistant, you can import them into the Script Library.
-
In the Script Library panel, click
to import commands from Cloud Assistant. -
From the list that appears, select the commands you want to import.
-
Click Import. The selected commands are added as new scripts.
Run a script
-
Log on to a Linux instance using Workbench.
For Windows instances, you must log on with Session Manager to run scripts from the PowerShell interface. You cannot run scripts from the Script Library if you connect with a direct terminal connection (Remote Desktop Protocol (RDP)).
-
In the navigation pane of Workbench, click
to open the Script Library, and then find the script you want to run. -
Click
next to the script to run it. -
In the Run Script dialog box, choose Run or Create file before running.
-
Run: This mode pastes the script content line by line into the current terminal. Use this method for simple, independent command sequences.
-
Create file before running: This mode saves the entire script as a temporary file on the instance and then runs the file. This method is recommended for standard scripts.
To ensure the script runs as expected, we recommend selecting the Create file before running mode for any multi-line script.
You can edit the script in the code editor. These changes apply only to the current execution and are not saved to the Script Library.

-
FAQ
-
Troubleshooting script execution failures
-
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.
-
-
Script storage and cross-device access
The Script Library is stored on Alibaba Cloud and linked to your Alibaba Cloud account. The library automatically syncs for the account and its RAM users, so you can access your scripts from any computer.