Cloud Assistant lets you create reusable commands and run them on Elastic Compute Service (ECS) instances without logging in. Use commands to automate O&M tasks such as running scripts, polling processes, resetting passwords, installing or uninstalling software, updating applications, and applying patches.
Supported command types:
| OS | Supported types |
|---|---|
| Linux | Shell, Python, Perl |
| Windows | Bat, PowerShell |
Limits
| Resource | Limit |
|---|---|
| Commands per region | 500–50,000 (quota applies to your account; may increase with ECS usage) |
| Max Base64-encoded script size | 18 KB |
| Custom parameters per command | 20 |
To view your current quota or request an increase, see Manage quotas. Include a detailed reason in your quota increase request to improve approval chances.
Prerequisites
Before you begin, make sure that you have:
An Alibaba Cloud account with ECS access
(Optional) A resource group, if you want to control command permissions at the resource group level using Resource Access Management (RAM)
Create a command in the ECS console
Do not include sensitive information — such as AccessKey pairs, passwords, or authorization codes — as plaintext in command content. Use custom parameters in the {{key}} format and supply values at runtime.
In the top navigation bar, select the region and resource group where you want to create the command.
Selecting a resource group lets you manage command permissions at the resource group level using RAM policies. For details, see Cloud Assistant command-specific sample custom policies and Classify resources into resource groups and grant permissions on the resource groups.

In the upper-right corner of the ECS Cloud Assistant page, click Create/Run Command.
In the Command Information section of the Create Command panel, configure the following parameters. Command type Select the type that matches your target instance OS: Command content Enter or paste the command. Make sure the syntax, logic, and algorithm are correct before saving. Example — archive a file to
/backupon a Linux instance:Run at Fixed Interval: Specify an interval using a rate expression (60 seconds–7 days). The interval is the time between consecutive executions, not the execution duration. For example, if the interval is 5 minutes and a run takes 2 minutes, the next run starts 3 minutes after the previous run ends. The first run starts after the interval elapses from task creation. > Note: The interval must be longer than the command's timeout period.
Run Only Once at Specified Time: Set a specific date, time, and time zone. For example, May 17, 2022, 17:30:50 with (GMT+08:00) Asia/Shanghai runs the command once at that timestamp.
Run on Clock-based Schedule Cron Expression: Use a cron expression (accurate to seconds) and select a time zone. The minimum interval is 10 seconds and must exceed the timeout period. For example,
0 0 12 ? * WED 2022with (GMT+08:00) Asia/Shanghai runs the command every Wednesday at 12:00:00 in 2022. For syntax details, see Cron expressions.
Version requirements apply as follows: - `{{ACS::InstanceId}}` and `{{ACS::InstanceName}}`: When running a command on multiple instances, make sure the Cloud Assistant Agent on each instance meets the minimum version listed above. - `{{ACS::InvokeId}}`: Make sure the Cloud Assistant Agent version meets the minimum version listed above. - `{{ACS::CommandId}}`: When calling the RunCommand API, make sure the Cloud Assistant Agent version meets the minimum version listed above. To upgrade, see Install Cloud Assistant Agent.
Command source
Option Description Enter Command Content Write a new command. Select Saved Command Use an existing saved command. Parameter Description Minimum Cloud Assistant Agent version {{ACS::RegionId}}Region ID — {{ACS::AccountId}}Alibaba Cloud account UID — {{ACS::InstanceId}}Instance ID Linux >= 2.2.3.309, Windows >= 2.1.3.309 {{ACS::InstanceName}}Instance name Linux >= 2.2.3.344, Windows >= 2.1.3.344 {{ACS::InvokeId}}Command task ID Linux >= 2.2.3.309, Windows >= 2.1.3.309 {{ACS::CommandId}}Command ID Linux >= 2.2.3.309, Windows >= 2.1.3.309 Execution plan
Option Behavior Immediate execution Runs as soon as you click Run or Run and Save. After the next startup of the system Runs the next time the associated instances start. After each system startup Runs every time the associated instances start. Run on Schedule Runs on a defined schedule. See schedule options below. Other parameters
Parameter Description Command Name A name for the command. Command Description A description. Include the purpose of the command to simplify future management. Username The OS user that runs the command on instances. Default: rooton Linux,systemon Windows. Run commands as a user with the minimum required privileges. See Run Cloud Assistant commands as a regular user.Execution Path The directory in which to run the command. Default: /home(Linux root user home directory) orC:\Windows\system32(Windows).Timeout Maximum time allowed for the command to run, in seconds. Default: 60. Minimum: 10. Values below 10 are automatically set to 10. Tag A tag (key-value pair) to classify and manage the command. If you click Run and Save, the tag is applied to both the command and the execution task. If you click Run, the tag is applied to the command only. #!/bin/bash OF=/backup/my-backup-$(date +%Y%m%d).tgz tar -cf $OF {{file}}In this example,
{{file}}is a custom parameter. Set it to the file path at runtime (for example,/app/usrcredential). For more information, see View the system configurations of ECS instances. Use parameters Turn on Use Parameters to define custom parameters in the{{key}}format in your command content. You can specify up to 20 custom parameters per command. Cloud Assistant also provides built-in environment parameters that are resolved automatically at runtime: Run on Schedule options:In the Select Instance and Select Managed Instances sections, select the instances on which to run the command.
A managed instance is a non-ECS server managed by Cloud Assistant. For details, see Alibaba Cloud managed instances.
Click Save.
Create a command using Alibaba Cloud CLI
Call the CreateCommand API to create a command. The following example creates a command named update that updates the operating system on Linux instances.
aliyun ecs CreateCommand --RegionId 'cn-hangzhou' \
--CommandContent 'eXVtIHVwZGF0ZSAteQ==' \
--Type 'RunShellScript' \
--Name 'update' \
--Description 'update' \
--output cols=CommandIdThe values in single quotes are examples. Replace them with your actual values.
Key parameters:
| Parameter | Example | Description |
|---|---|---|
RegionId | cn-hangzhou | The region where the command is created. |
Name | update | The command name. |
Type | RunShellScript | The command type: RunShellScript (Linux Shell), RunBatScript (Windows Bat), or RunPowerShellScript (Windows PowerShell). |
CommandContent | eXVtIHVwZGF0ZSAteQ== | The Base64-encoded command content. |
Description | update | The command description. |
For the full parameter reference, see CreateCommand.
Sample response:
CommandId
---------
c-hz018qng4on****What's next
After creating a command, view it on the My Commands tab. To run the command on specific instances, see Run a command.
If you enabled Use Parameters when creating the command, enter parameter values in the Command Parameters fields when running the command.