Using COC to Batch Execute Commands for Multiple ECSs
Scenarios
As Huawei Cloud ECSs have grown exponentially during the advanced stages of digital transformation, they play a critical role in supporting stable business systems. However, traditional O&M models now struggle to scale alongside massive resource pools that often contain hundreds or thousands of ECSs.
Before COC's batch execution was introduced, O&M teams typically relied on RDP or SSH to log in to ECSs individually. This approach works for limited resources, but it creates significant bottlenecks during high-frequency scenarios, such as batch version upgrades, large-scale configuration alignment, urgent security baseline hardening, and health check script delivery. These manual operations slow down application responses and make it difficult to maintain consistency as the number of ECSs increases.
In large-scale scenarios, traditional O&M methods are caught in a conflict between efficiency and risks.
- Efficiency conflict: Individually vs. Batch
A direct contradiction exists between the linear time required for manual operations and the non-linear growth of business demands. For example, updating 10 servers may take only half an hour, but updating 100 servers may take several hours or even longer. This not only consumes a large number of human resources, but also causes a long maintenance window, reducing service availability.
- Risk conflict: Human error vs. Consistency
When manually writing scripts or repeatedly entering commands, O&M personnel are prone to typos or parameter misconfigurations (such as incorrect paths or version numbers) due to fatigue. More critically, when different O&M personnel perform tasks at different times without a unified standard, the cluster suffers from "configuration drift." This means that although the hardware remains identical, the software environments diverge. This is a common root cause of production outages.
Solutions
Huawei Cloud COC's batch command execution builds a standardized, automated, and auditable O&M closed-loop system. It evolves traditional manual serial O&M into automated parallel O&M.
-
Replacing serial operations with batch execution: reducing costs and increasing efficiency
This feature allows you to easily filter ECSs by tag, enterprise project, or resource pool, reducing hours of manual labor into minutes. O&M personnel only need to code a standardized script once (using Shell, Python, or Bat). The system then uses UniAgent to dispatch tasks to all target ECSs simultaneously. This enables parallel processing for large-scale operations and drastically accelerates response times.
-
Mitigating risk through standardization: ensuring consistency
This feature enforces pre-execution script validation and OS isolation (ensuring separate execution for Linux and Windows). By using a unified script repository and standardized operational parameters, the system eliminates human error and inconsistency. This ensures that all instances within a cluster maintain a synchronized configuration at all times, fundamentally reducing configuration drift and lowering the rate of operation failures.
This section describes how to batch execute commands to query the disk usage of multiple ECSs.
Precautions
- The target ECSs must be running.
- The UniAgent of the ECSs is running. For details, see Installing UniAgent on a Host.
- If the selected ECSs run on different OSs (Linux and Windows), execute commands for the ECSs separately.
Prerequisites
You have registered a Huawei ID and enabled Huawei Cloud services and logged in to the system.
Batch Executing Commands
- Log in to COC.
- In the navigation pane, choose Resource O&M > Batch Resource Operations.
- On the Elastic Cloud Server tab page, click Execute Commands.
- Set the parameters for batch command execution by referring to Table 1.
Table 1 Parameters for batch command execution Parameter
Example Value
Description
Target Instance
Target ECSs
Click Add and select the target ECSs.
Operating System
Linux
OS type of the target instances. Linux and Windows are supported.
Select an OS type the same as that of the target instances.
Execution User
root
For ECSs running on Linux, the preset value is root. You can change it as needed.
Execution Plan
Execute Now
Execution plan of the command. The default value is Execute Now and cannot be changed.
Timeout Interval
60
A timeout interval for executing a command. If the time limit is reached, the system forcibly terminates the sending process.
The unit is seconds.
Command Type
Shell
Type of the script command to be sent.
Command Input
df -h
The command must be able to return results after a single execution. Interactive commands requiring secondary input are not supported.
Figure 1 Setting batch command execution
- Click OK and wait until the command is executed.
Verifying the Execution Result
After the command is executed, you can check the execution result in the Command Output area.
Click the instance name to switch to the corresponding tab page and view the disk usage of the ECS.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot