Use Alibaba Cloud-provided common commands to install software, diagnose instances, and rotate keys without writing scripts.
Background
Common commands are Cloud Assistant commands created and maintained by Alibaba Cloud. They consist of scripts or Cloud Assistant plugins for tasks such as server configuration, health and security checks, application installation, file management, patch installation, and service management.
Unlike custom commands, common commands are managed by Alibaba Cloud. You can view details, run them on ECS instances, and track progress and results. For example, you can upgrade the Cloud Assistant Agent on a Linux instance, install Java, or diagnose disk resize needs with a single click.
Procedure
View and run common commands by using one of the following methods.
ECS console
In the upper-left corner of the page, select a region and resource group.
-
On the ECS Cloud Assistant page, click the Common Commands tab.
This tab lists all common commands.
-
Find the target command and click Run.
NoteOnly the latest version of each command is displayed. To view or run a previous version, click the command ID to open the details page.
-
In the Run Command panel, configure the parameters and click Run.
Main parameters:
Section
Parameter
Description
Command Information
Command content
Click View command content to verify the command.
Execution plan
Select an execution plan. Options:
-
Immediate execution
-
After the next startup of the system
-
After each system startup
-
Timing execution
Run as
The user account used to run the command, for example, root.
By default, commands are run as the
rootuser on Linux instances and as theSystemuser on Windows instances.Timeout
The timeout for command execution, in seconds. Valid values: 10 to 86,400 (24 hours). If execution exceeds this timeout, Cloud Assistant forcibly terminates the process. Default: the timeout defined in the command.
Command parameters
If the Command Parameters section is displayed, enter custom parameter values. The available parameters depend on the command.
NoteIf the command provider specifies parameter descriptions, default values, or allowed values, enter values as prompted. Required parameters must be filled in to run the command.
Select Instances
-
Select one or more instances to run the command on. Instances must be in the Running state with Cloud Assistant Agent installed.
Select Managed Instances
-
Select the managed instances to run the command on. Managed instances must be in the Connected state with Cloud Assistant Agent installed.
NoteManaged instances are non-Alibaba Cloud servers managed by Cloud Assistant. See managed instances.
NoteSee Run a command from the console for details on all parameters.
-
-
On the Command execution result tab, find the executed command and click View in the Actions column.
If the Execution Status is Successfully Executed, you can view the command output.
NoteIf the command fails, view the error message and troubleshoot. See Common errors and troubleshooting.
OpenAPI
-
View common commands.
Call the DescribeCommands operation to view common commands. You can also query by command name.
Key parameters:
-
Name: The command name. For example, set this to ACS-ECS-DiskResize-Diagnostic-for-linux.sh to query that command in a specific region.
-
Provider: The command provider. Set to AlibabaCloud to return all common commands.
-
-
Run a common command.
Based on the
CommandIdreturned in Step 1, call the InvokeCommand operation. You can also run a common command by name. Command names are consistent across regions.Key parameter:
CommandId: The command ID. For a common command, you can set this to the command name. Example: ACS-ECS-DiskResize-Diagnostic-for-linux.sh.
A successful call returns an
InvokeId(for example,t-hz02kwqc9pg****), which is the execution ID. Call DescribeInvocations or DescribeInvocationResults to query the result.You can also view the output on the execution details page to check whether the instance needs a disk resize.
Alibaba Cloud CLI
-
View common commands with Alibaba Cloud CLI.
Run the describe-commands command to view common commands.
-
Set
--providertoAlibabaCloudto return all common commands. -
Set the provider to a specific value to return commands from that provider.
Query all common commands in the China (Hangzhou) region:
aliyun ecs DescribeCommands \ --region 'cn-hangzhou' \ --Provider 'AlibabaCloud'Query the
ACS-ECS-DiskResize-Diagnostic-for-linux.shcommand, which diagnoses whether a Linux instance requires a disk resize:aliyun ecs DescribeCommands \ --region 'cn-hangzhou' \ --CommandId 'ACS-ECS-DiskResize-Diagnostic-for-linux.sh'
-
-
Run a common command with Alibaba Cloud CLI.
Run the InvokeCommand command to run a common command on one or more ECS instances.
Diagnose whether a Linux instance requires a disk resize:
aliyun ecs InvokeCommand --RegionId 'cn-hangzhou' \ --InstanceId.1 'i-bp1f4f6o8lv0wqof****' \ --InstanceId.2 'i-bp137qu6142s3mhm****' \ --CommandId 'ACS-ECS-DiskResize-Diagnostic-for-linux.sh' \ --Timed 'false'A successful call returns an
InvokeId(for example,t-hz03rj5u0jx****), which is the execution ID. Run DescribeInvocations or DescribeInvocationResults to query the result. Example:aliyun ecs DescribeInvocations --RegionId 'cn-hangzhou' \ --InvokeId 't-hz03rj5u0jx****'You can also view the output on the execution details page to check whether the instance needs a disk resize.