Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Scripts

Updated on 2024-11-25 GMT+08:00

The Scripts page displays information about all existing scripts. You can create, modify, or copy a script. After a script is created, you can create an execution task for the script. Alternatively, you can create a task and execute and view it on the Tasks page. Each script supports up to 20 versions. Each user can create up to 1000 script versions.

Creating a Script

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane, choose Automation (Retiring). The Automation page is displayed.
  3. In the navigation pane, choose Scripts and click Create Script in the upper right corner.
  4. Set parameters by referring to Table 1.

    Figure 1 Creating a script
    Table 1 Script information description

    Category

    Parameter

    Description

    -

    Script Name

    Name of a script. Enter up to 64 characters. Only letters, digits, and underscores (_) are allowed.

    Version

    Version of the script. Enter the actual value.

    Enterprise Project

    Select the enterprise project to which the script belongs.

    Script Description

    Description of the script. Enter up to 1000 characters.

    Script

    • Manually enter commands. Currently, Shell, BAT, PowerShell, and Python scripts can be executed. A script can contain up to 30,000 bytes.
      NOTE:
      • Shell and Python scripts can be executed only on Linux hosts.
      • BAT and PowerShell scripts can be executed only on Windows hosts.
    • The UniAgent reads the standard output of the script and writes it into logs. The print() output of Python has a cache and may not be updated to the standard output in real time. As a result, the execution logs of the Python script cannot be updated in real time. To output Python logs in real time, use any of the following methods:
      • Use sys.stdout.flush() to print the output.
      • Use sys.stderr.write() to print the output.
      • Use print(message.flush=True) to print the output.
    • After setting the parameters, click Check for High-Risk Commands. High-risk commands undergo regular expression verification. If the verification fails, risks may occur. For details about high-risk commands, see Table 1.

    Execution Policy

    Batch Release

    Specifies whether to enable batch release. By default, this function is disabled.

    Instances for Each Batch

    Number of instances on which tasks can be executed at the same time.

    Interval

    Interval for executing each batch of tasks.

    Review

    Review

    Specifies whether to enable manual review. By default, this function is disabled.

    You can only modify the review configuration by modifying the atomic service card in the tool market.

    Reviewer

    After manual review is enabled, you need to select a reviewer.

    Alternatively, create a topic and add a subscription on the SMN console to notify a reviewer.

  5. Click Save.

Releasing a Script

After a script is created, it is in the Unreleased state. The script task can be executed only after the script is released.

  1. In the navigation pane, choose Scripts. On the version management page, locate the row that contains the target version and click Release in the Operation column.

    Figure 2 Releasing a script

  2. On the release confirmation dialog box that is displayed, click Yes.

Executing a Script

After a script is released, you can execute the script task on the script list page. Script execution depends on the UniAgent capability. You need to ensure that the UniAgent has been installed and is running on the ECS where the script is to be executed.

  1. In the navigation pane, choose Scripts. On the script management page, locate the target script and click Execute in the Operation column.
  2. Specify Script Parameters, Timeout Duration, and Execution Account. You can also select Sensitive for script parameters. If Sensitive is selected, the entered content will not be explicitly displayed in the script parameter box.

    Figure 3 Script parameters

  3. Select target instances.

    1. Click Add. The instance selection page is displayed.
    2. For Instance Type, the default value is ECS. For Method, the default value is Specific. For details about the methods, see Table 2.
      Figure 4 Adding instances
      Table 2 Selection method description

      Selection Method

      Description

      Specific

      Enter search criteria and select instances from the instance list. By default, instances are searched by name.

      By filter

      • Enter filter attributes and values to search for instances.
      • If there are multiple filter criteria, the search is performed based on the AND relationship.
      • This method also takes effect for instances added later.

      By tag

      • Set tag keys and values, and specify one or more tags to select instances.
      • If there are multiple tags, the search is performed based on the AND relationship.
      • This method also takes effect for instances added later.

      From CMDB

      Enter search criteria or keywords and select instances from CMDB. There are two types of nodes:

      • Static: Select an ECS under a specified CMDB application.
      • Dynamic: Select a node in the CMDB application to dynamically obtain ECSs under the node. This method also takes effect for instances added later.
    3. Click OK.

  4. Click Execute. On the task execution page that is displayed, view the task execution status.

    You can also click Save. The created task is displayed on the task management page for subsequent task execution or other operations.

More Operations

After the script is created, you can view the script name, version, and creation time on the script list page. You can also perform the operations listed in Table 3.

Table 3 Related operations

Operation

Description

Managing a script version

Click Manage Version in the Operation column. On the version management page that is displayed, view and modify the script version information and execute the script as required.

Copying and creating a script

On the version management page, click Copy and Create in the Operation column of a released or unreleased script and copy the original script content to create a script.

Managing an unreleased script

On the version management page, click Release, Modify, or Delete in the Operation column of a script that has never been released. A script can only have one released version. Tasks associated with an unreleased version cannot be executed. After the version is released again, the tasks can be executed.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback