Home >Operation and Maintenance >Linux Operation and Maintenance >How to create a cloud assistant command in an ECS instance
The content of this article is about how to create cloud assistant commands in ECS instances. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Create command
Cloud assistant commands can quickly complete running automated operation and maintenance scripts, polling processes, resetting user passwords, installing or uninstalling software, updating applications, and installing patches in ECS instances. some daily tasks. The command type can be Windows PoweShell script, Bat batch command and Linux Shell script.
Usage Limitations
In an Alibaba Cloud region, you can create up to 100 cloud assistant commands.
The size of the created script cannot exceed 16KB after Base64 encoding.
Create a command
The steps to create a command on the ECS management console are as follows:
Log in to the ECS management console.
In the left navigation bar, select Cloud Assistant.
Select a region.
Click to create a command, and in the pop-up window on the right:
Enter the command name, such as HelloECS.
Enter the command description, such as UserGuide.
Click the icon and select the command type in the drop-down list. You can choose Bat or Power Shell for Windows instances, while you need to choose Shell for Linux instances.
Edit or paste your command content, for example:
echo hello ECS!
echo root:NewPasswd9! | chpasswd
echo Remember your password!
Determine the execution path of the command. By default, Bat or PowerShell commands are in the directory where the cloud assistant client process is located, for example, C:\ProgramData\aliyun\assist\$(version). Shell commands are in the /root directory by default.
Set the maximum timeout length of the command in the instance, in seconds, and the default is 3600 seconds. Timeouts occur when a command you create cannot be run for some reason. After timeout, the command process will be forcibly terminated.
After confirming the command, click OK.
You can also use the ECS API CreateCommand to create a cloud assistant command.
Next step
Execute command
The above is the detailed content of How to create a cloud assistant command in an ECS instance. For more information, please follow other related articles on the PHP Chinese website!