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
On this page

Creating Scripts in Agent Images

Updated on 2024-02-05 GMT+08:00

Precautions

  • You need to prepare scripts based on the OS of the servers to be migrated.
  • You need to prepare required scripts on your own. If you need help, contact the Huawei Cloud migration team.
  • The script examples below are only for reference.
  • You can download test scripts from the Huawei Support website for reference.

Windows

  1. In the C:\ directory, create a folder and name it smsWindowesAgent. In this folder, create three folders and name them bin, Python, and smsAgent respectively.

    Folder

    Function

    Location

    bin

    Stores the startup scripts and the peagent folder.

    C:\smsWiondowesAgent\bin

    python

    Installs Python.

    C:\smsWiondowesAgent\python

    smsAgent

    Stores Python scripts for obtaining metadata.

    C:\smsWiondowesAgent\smsAgent

    peagent

    Stores migration components transferred from source servers.

    C:\smsWiondowesAgent\bin\peagnet

  2. In the smsAgent folder, store the scripts used for obtaining certificates and keys.

    SMS-Agent uploads SSH public and private keys to metadata of target servers. The scripts you prepared here will be used to obtain the keys from the metadata. The table below shows the three types of metadata.

    Script

    Function

    Destination File

    sms_rsa_part (to be deprecated)

    Obtains SSH public keys (for server and identity authentication).

    C:\Users\Administrator\.ssh\authorized_keys,C:\ProgramData\ssh\ssh_host_rsa_key.pub

    sms_rsa_pri_part (to be deprecated)

    Obtains SSH private keys (for server and identity authentication).

    C:\ProgramData\ssh\ssh_host_rsa_key

    sms_rsa_host_old

    Obtains new SSH public keys (for server authentication).

    C:\ProgramData\ssh\ssh_host_rsa_key.pub

    sms_rsa_host_old_pri

    Obtains new SSH private keys (for server authentication).

    C:\ProgramData\ssh\ssh_host_rsa_key

    sms_rsa_identity

    Obtains SSH public key certificates (for identity authentication).

    C:\Users\Administrator.ssh\authorized_keys

    cert_part (to be deprecated)

    Obtains TSL 1.2 authentication public keys.

    C:\smsWindowesAgent\bin\peAgent\config\cert.pem

    prikey_part (to be deprecated)

    Obtains TSL 1.2 authentication private keys.

    C:\smsWindowesAgent\bin\peAgent\config\prikey.pem

    sms_rsa_part and sms_rsa_pri_part obtain the SSH public keys and private keys from metadata and write them to the destination files listed in the table above.

  3. In the bin directory, add a script to check whether peagent.exe is running.

    'tasklist /nh /fi "imagename eq peAgent.exe'

    • If it is not running, add the following command to start it.

      start cmd /k "C:\smsWindowesAgent\bin\peAgent\peAgent.exe"

    • If it is running, end the script.

    This script should be executed after the scripts in the smsAgent folder are executed.

Linux

  1. In the ~ directory, create a folder and name it smsMetadataAgent. In this folder, create three folders and name them bin, Python, and smsAgent respectively.

    Folder

    Function

    Location

    bin

    Stores the startup scripts and the peagent folder.

    ~\smsMetadataAgent\bin

    smsAgent

    Stores Python scripts for obtaining metadata.

    ~\smsMetadataAgent\smsAgent

  2. Prepare scripts for obtaining public and private keys from metadata by referring to the Windows section.

    Script

    Function

    Destination File

    sms_rsa_part (to be deprecated)

    Obtains SSH public keys (for server and identity authentication).

    root/.ssh/authorized_keys, /etc/ssh/ssh_host_rsa_key.pub

    sms_rsa_pri_part (to be deprecated)

    Obtains SSH private keys (for server and identity authentication).

    /etc/ssh/ssh_host_rsa_key

    sms_rsa_host_old

    Obtains new SSH public keys (for server authentication).

    /etc/ssh/ssh_host_rsa_key.pub

    sms_rsa_host_old_pri

    Obtains new SSH private keys (for server authentication).

    /etc/ssh/ssh_host_rsa_key

    sms_rsa_identity

    Obtains SSH public key certificates (for identity authentication).

    /root/.ssh/authorized_keys

    cert_part (to be deprecated)

    Obtains TSL 1.2 authentication public keys.

    /home/config/cert.pem

    prikey_part (to be deprecated)

    Obtains TSL 1.2 authentication private keys.

    /home/config/prikey.pem

    Prepare startup scripts by referring to the Windows section.

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