Cloud Assistant is a native automated O&M tool developed for Elastic Compute Service (ECS). Cloud Assistant allows you to batch run commands, such as shell, PowerShell, and batch commands, to execute various tasks on ECS instances in a password-free manner without the need to log on to the instances or use jump servers. You can use Cloud Assistant to perform automated O&M tasks, poll processes, install or uninstall software, start or stop services, and install patches or security updates.
Benefits
Support for batch operations
You can run a command simultaneously on multiple ECS instances on which Cloud Assistant Agent is installed. The execution status and results of the command on one ECS instance do not affect the other ECS instances.
Support for uploading files
You can upload files, such as configuration files and scripts, from on-premises to ECS instances.
Common commands
Common commands include Cloud Assistant plug-ins in the form of scripts or executables and specific complex scripts that are used to configure servers, perform health or security checks, install applications or system patches, process files, update system configurations, and manage services or applications. You can run common commands to complete complex configurations in an easy and quick manner, which significantly improves the efficiency of O&M.
Ease of use
You can configure custom or built-in parameters in commands to adapt to different scenarios.
Security and controllability
Cloud Assistant does not initiate any operations on its own. You have full control over all Cloud Assistant operations.
Scenarios
Cloud Assistant helps you perform deployment and O&M tasks on ECS instances. The following list provides some examples of the tasks:
Uploading and running automated O&M scripts
Running scripts that are already uploaded to instances
Managing software lifecycle
Deploying code or applications
Polling processes
Installing patches or security updates
Obtaining updates from Object Storage Service (OSS) or Yellowdog Updater, Modified (YUM) repositories
Changing hostnames or user logon passwords
Limits
The ECS instances on which you want to use Cloud Assistant must be in the Running (Running
) state and Cloud Assistant Agent must be installed on the instances.
For files or commands that consist of batch, PowerShell, or shell scripts with custom parameters, the following size limits apply after Base64 encoding:
If a command is created not by using the immediate execution feature, the command cannot exceed 18 KB in size after Base64 encoding.
If a command is created and run simultaneously by using the immediate execution feature and is saved, the command cannot exceed 18 KB in size after Base64 encoding.
If a command is created and run simultaneously by using the immediate execution feature but is not saved, the command cannot exceed 24 KB in size after Base64 encoding.
A file that you want to upload cannot exceed 32 KB in size after Base64 encoding.
Each command can contain up to 20 custom parameters.
Cloud Assistant commands can be run only on instances that use the following operating system versions:
Alibaba Cloud Linux
CentOS 6, CentOS 7, and CentOS 8 and later
CoreOS
Debian 8, Debian 9, and Debian 10 and later
openSUSE
Red Hat 5, Red Hat 6, and Red Hat 7 and later
Note
For Red Hat instances, you must download the Red Hat Package Manager (RPM) package to install Cloud Assistant Agent. For more information, see Install Cloud Assistant Agent.
SUSE Linux Enterprise Server (SLES) 11, SLES 12, and SLES 15 and later
Ubuntu 12, Ubuntu 14, Ubuntu 16, and Ubuntu 18 and later
FreeBSD 11, FreeBSD 12, FreeBSD 13, and FreeBSD 14 and later
Windows Server 2012, Windows Server 2016, and Windows Server 2019 and later
Note
By default, Cloud Assistant Agent is installed on ECS instances that are created from public images.
For ECS instances that are created from custom images or Alibaba Cloud Marketplace images, you must check whether the operating systems support Cloud Assistant before you install Cloud Assistant Agent. For more information, see Install Cloud Assistant Agent.
Supported features and versions
The following table describes the features that are supported by Cloud Assistant and the earliest supported version of Cloud Assistant Agent for each feature.
Feature supported by Cloud Assistant | Earliest supported version of Cloud Assistant Agent for Linux instances | Earliest supported version of Cloud Assistant Agent for Windows instances |
Feature supported by Cloud Assistant | Earliest supported version of Cloud Assistant Agent for Linux instances | Earliest supported version of Cloud Assistant Agent for Windows instances |
Reporting Cloud Assistant heartbeats | 1.0.2.458 | 1.0.0.149 |
Sending files | 1.0.2.569 | 1.0.0.149 |
Specifying a username to use to run a command | 2.2.0.106 | 2.1.0.50 |
Configuring a command to run on next instance startup | 2.2.0.46 | 2.1.0.50 |
Configuring a command to run on every instance startup |
Session Manager | 2.2.3.196 | 2.1.3.196 |
Using a rate expression or an at expression in the execution plan of a scheduled task | 2.2.3.282 | 2.1.3.282 |
Specifying a cron expression that includes a <Year> field or a <Time zone> field in the execution plan of a scheduled task | 2.2.3.282 | 2.1.3.282 |
Specifying built-in environment parameters | 2.2.3.309 | 2.1.3.309 |
Using instance names as built-in environment parameters | 2.2.3.344 | 2.1.3.344 |
Using specific exit codes to stop or restart instances | 2.2.3.317 | 2.1.3.317 |
Specifying the name of a container in which to run a command | 2.2.3.344 | 2.1.3.344 |
Specifying the ID of a container in which to run a command | 2.2.3.344 | 2.1.3.344 |
Billing
Cloud Assistant is provided free of charge.
However, you may be charged when you use Cloud Assistant to deploy, operate, or maintain Alibaba Cloud resources. For information about the billing of ECS resources, see Billing overview.
Resources
Cloud Assistant Agent uses the resources of the host on which Cloud Assistant Agent is installed. The following table describes the host resources.
Host resource | Linux operating system | Windows operating system |
Host resource | Linux operating system | Windows operating system |
CPU | The average CPU utilization is less than 1%. |
Physical memory | About 20 MB of physical memory is used. | About 30 MB of physical memory is used. |
Disk I/O | When Cloud Assistant Agent runs as expected, it leverages disk I/O operations only in specific scenarios, such as scenarios in which upgrade packages are downloaded and in which command scripts are saved. |
Network I/O | When Cloud Assistant Agent runs as expected, it leverages a few network I/O operations only in scenarios when data is reported, such as heartbeat data. |
Terms
The following table describes relevant terms in Cloud Assistant.
Term | Description |
Cloud Assistant | A tool provided by Alibaba Cloud that helps you perform routine maintenance tasks on multiple ECS instances and ECS bare metal instances. Cloud Assistant is available in all Alibaba Cloud regions. |
Cloud Assistant Agent | A lightweight plug-in that can be installed on ECS instances to run Cloud Assistant commands. On Windows instances, the process of Cloud Assistant Agent is aliyun_assist_service. On Linux instances, the process of Cloud Assistant Agent is aliyun-service.
|
Cloud Assistant daemon process | A daemon process that is used to monitor the resource consumption of Cloud Assistant Agent, report the status of Cloud Assistant Agent, and restart Cloud Assistant Agent when Cloud Assistant Agent fails. Note The Cloud Assistant daemon process is available only on Linux instances. |
task execution path | A path in which Cloud Assistant saves your command as a file on an ECS instance and executes the file. The path varies based on operating systems. |
command | A specific command that can be run on ECS instances. Example: a command that consists of a shell or PowerShell script. |
custom parameter | A variable that you specify in the {{key}} format in a command. You can specify a custom parameter and the value of the parameter in the {{"<key>":"<value>"}} format when you create a task to run the command. You can retain a limited number of Cloud Assistant commands in each Alibaba Cloud region. To adapt Cloud Assistant commands to multiple scenarios, we recommend that you configure custom parameters. You can also specify built-in environment parameters as custom parameters in a command. Then, when you run the command, the custom parameters can be automatically specified by Cloud Assistant. |
one-time execution | The execution (Invocation ) of a one-time task. A one-time task runs a command only once on one or more ECS instances. |
scheduled execution | An execution of a scheduled task. A scheduled task runs a command on one or more ECS instances based on a schedule. |
Execution status
Execution status of a command that is run on a single ECS instance
The following table describes the instance-level execution status of a command that is run on a single ECS instance. The InvocationStatus
response parameter in the InvokeInstance
array provided by the DescribeInvocations operation and the InvocationStatus
response parameter provided by the DescribeInvocationResults operation both indicate the execution status of a command.
Status in API responses | Description | Details |
Status in API responses | Description | Details |
Pending
| The command is being sent. | The command is being verified or sent. |
Invalid
| Invalid command. | The specified command type or parameter is invalid. |
Aborted
| The command fails to be sent. | The command fails to be sent. To send a command to an ECS instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute. |
Running
| The command is being run. | The command is being run. |
Success
| The command is run. | Command that is set to run only once: The execution is complete, and the exit code is 0. Command that is set to run on a schedule: The previous execution is complete, the exit code is 0, and the specified period ends.
|
Failed
| The command is run and returns a non-zero exit code. | Command that is set to run only once: The execution is complete, and the exit code is not 0. Command that is set to run on a schedule: The previous execution is complete, the exit code is not 0, and the specified period is about to end.
|
Error
| An error occurred while the command is being run. | The execution cannot continue due to an exception. |
Timeout
| A timeout occurred. | The execution timed out. |
Cancelled
| The task is canceled. | The task is canceled, and the command is not run. |
Stopping
| The task is being stopped. | The command is being stopped. |
Stopped
| The task is stopped. | The command is stopped. |
Terminated
| The task is terminated. | The command is terminated. |
Scheduled
| The command is pending execution. | Command that is set to run on a schedule: The command is waiting to be run. |
Status of batch executions and scheduled executions
A batch execution is a one-time execution in which a command is run simultaneously on multiple ECS instance. To better manage batch executions or scheduled executions, you can manage the lifecycles of the executions based on the overall execution status, instance-level execution status, and execution-level status. The InvocationStatus
parameter in the Invocation
parameter array that is provided by the DescribeInvocations operation indicates the execution status of a command. The following figure shows the relationships among the three types of execution status.
The following table describes the overall execution status of a command that is run on multiple ECS instances at the same time.
Status in API responses | Description | Details |
Status in API responses | Description | Details |
Pending
| The command is being verified or sent. | When the execution state is Pending on at least one ECS instance, the overall execution state is Pending . |
Scheduled
| The command that is set to run on a schedule is sent and pending execution. | When the execution state is Scheduled on at least one ECS instance, the overall execution state is Scheduled . |
Running
| The command is being run. | When the execution state is Running on at least one ECS instance, the overall execution state is Running . |
Success
| The command is run. | When the execution state is Success on at least one ECS instance and is Stopped or Success on the other ECS instances, the overall execution state is Success . Command that is set to immediately run: The execution is complete, and the exit code is 0. Command that is set to run on a schedule: The last execution is complete, the exit code is 0, and the specified period ends.
|
Failed
| The command fails to be run. | When the execution state is Stopped or Failed on all ECS instances, the overall execution state is Failed . When the execution status on an ECS instance is one of the following values, Failed is returned as the overall execution state: Invalid : The command is invalid.
Aborted : The command fails to be sent.
Failed : The execution is complete, but the exit code is not 0.
Timeout : The execution timed out.
Error : An error occurred when the command is being run.
|
Stopping
| The task is being stopped. | When the execution state is Stopping on at least one ECS instance, the overall execution state is Stopping . |
Stopped
| The task is stopped. | When the execution state is Stopped on all ECS instances, the overall execution state is Stopped . When the execution status on an ECS instance is one of the following values, Stopped is returned as the overall execution state: |
PartialFailed
| The task succeeds on some ECS instances and fails on other ECS instances. | When the execution state is Success on some ECS instances and is Failed or Stopped on the other ECS instances, the overall execution state is PartialFailed . |
Grant a RAM user the permissions to use Cloud Assistant
An Alibaba Cloud account has full permissions on all resources within the account. To ensure the security of your Alibaba Cloud account and cloud resources, do not use your Alibaba Cloud account to perform operations unless required. We recommend that you use a Resource Access Management (RAM) user instead of an Alibaba Cloud account to perform operations. To use Cloud Assistant, grant the RAM user the required permissions. For information about how to grant a RAM user the permissions to use Cloud Assistant, see Grant a RAM user permissions to use Cloud Assistant.
Use Cloud Assistant
You can use Cloud Assistant in the ECS console or by calling an API operation.
Scenario | References | API operation |
Scenario | References | API operation |
By default, Cloud Assistant Agent is pre-installed on ECS instances that are created from public images on or after December 1, 2017. If Cloud Assistant Agent is not pre-installed on your ECS instance, you must manually install Cloud Assistant Agent. | Install Cloud Assistant Agent | |
Call API operations by using an application. | Run commands by using SDKs | N/A |
Create a Cloud Assistant command. | Create a command | |
Run a created command on ECS instances. | Run a command | |
View the execution status and results of commands. Execution results are the actual outputs generated on the specified ECS instances. | Check execution results and troubleshoot common issues | |
Modify a created command. You can modify the name and description of the command. | Manage commands | N/A |
Create a new version of a Cloud Assistant command or modify the attributes of the command, such as the name, description, type, content, execution path, and timeout period. | Clone a command | N/A |
Stop a command that is running. | Stop a command | StopInvocation |
Delete Cloud Assistant commands that you no longer require to free up quotas for new commands. | Delete a command | DeleteCommand |