How to Deploy Elastic Cloud Servers with Huawei Cloud API – A Complete Walkthrough
This article shares a developer's journey from using local virtual machines to mastering Huawei Cloud's elastic server deployment, providing a detailed step‑by‑step guide—including API calls, request/response examples, and code snippets—for creating, configuring, and verifying cloud servers via the Huawei Cloud API.
I was initially reluctant to use cloud servers for a new project, preferring local virtual machines, but after an intern demonstrated a quick cloud deployment, I decided to learn the process.
The intern handed me a document titled Creating Elastic Cloud Server Process Details , which contained the full API workflow and code examples.
Step 1: Determine the Availability Zone
1. Query available zones.
{
"availabilityZoneInfo":[
{
"hosts":null,
"zoneState":{"available":true},
"zoneName":"zone_01"
},
{
"hosts":null,
"zoneState":{"available":true},
"zoneName":"zone_01"
}
]
}2. Choose a zone and record its zoneName.
Step 2: Determine the Server Flavor
1. Query flavor details.
{
"flavors":[
{
"name":"c1.2xlarge",
"links":[
{"href":"https://xxx/v2.1/74610f3a5ad941998e91f076297ecf27/flavors/c1.2xlarge","rel":"self"},
{"href":"https://xxx/74610f3a5ad941998e91f076297ecf27/flavors/c1.2xlarge","rel":"bookmark"}
],
"ram":8192,
"OS-FLV-DISABLED:disabled":false,
"vcpus":8,
"swap":"",
"os-flavor-access:is_public":true,
"rxtx_factor":1,
"OS-FLV-EXT-DATA:ephemeral":0,
"disk":0,
"id":"c1.2xlarge"
}
]
}2. Choose a flavor and record its ID.
Step 3: Determine the Image
1. Query images.
{
"images":[
{
"OS-EXT-IMG-SIZE:size":0,
"metadata":{
"__os_type":"Linux",
"hw_vif_multiqueue_enabled":"true",
"__imagetype":"gold",
"__quick_start":"true",
"virtual_env_type":"FusionCompute",
"__support_xen":"true",
"__support_kvm":"true",
"__image_source_type":"uds",
"__platform":"EulerOS",
"__os_version":"EulerOS 2.2 64bit",
"__os_bit":"64",
"__isregistered":"false"
},
"created":"2018-05-14T06:13:50Z",
"minRam":0,
"name":"DBS-MySQL-Image_2.1.3.3",
"progress":100,
"links":[
{"rel":"self","href":"https://None/v2.1/74610f3a5ad941998e91f076297ecf27/images/11e8f727-d439-4ed1-b3b8-33f46c0379c4"},
{"rel":"bookmark","href":"https://None/74610f3a5ad941998e91f076297ecf27/images/11e8f727-d439-4ed1-b3b8-33f46c0379c4"},
{"rel":"alternate","href":"https://None/images/11e8f727-d439-4ed1-b3b8-33f46c0379c4","type":"application/vnd.openstack.image"}
],
"id":"11e8f727-d439-4ed1-b3b8-33f46c0379c4",
"updated":"2018-05-14T06:13:52Z",
"minDisk":40,
"status":"ACTIVE"
}
]
}2. Choose an image and record its ID.
Step 4: Determine Network Information
1. Query networks.
{
"networks":[
{
"id":"07a9557d-4256-48ae-847c-415a9c8f7ff6",
"label":"b_tt3_td1b",
"broadcast":null,
"cidr":null,
"dns1":null,
"dns2":null,
"gateway":null,
"netmask":null,
"cidr_v6":null,
"gateway_v6":null,
"netmask_v6":null
}
]
}2. Choose a network and record its ID.
Step 5: Set Up Key Pair Login
If you prefer password login, skip to Step 7.
1. Create a key pair.
{
"keypair":{
"type":"ssh",
"name":"demo1",
"user_id":"fake"
}
}Response example:
{
"keypair":{
"public_key":"ssh-rsa AAAAB3...Generated-by-Nova",
"private_key":"-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA...
-----END RSA PRIVATE KEY-----
",
"user_id":"f79791beca3c48159ac2553fff22e166",
"name":"demo1",
"fingerprint":"57:a7:a2:ed:5f:aa:e7:54:62:2e:bb:e7:92:22:cb:40"
}
}2. Import the key pair (same API endpoint, different request body).
{
"keypair":{
"public_key":"ssh-rsa AAAAB3...Generated-by-Nova",
"type":"ssh",
"name":"demo2",
"user_id":"fake"
}
}Response example:
{
"keypair":{
"public_key":"ssh-rsa AAAAB3...Generated-by-Nova",
"user_id":"f79791beca3c48159ac2553fff22e166",
"name":"demo2",
"fingerprint":"dd:44:45:49:d9:f6:4f:c0:24:2d:81:aa:c4:4b:83:c2"
}
}Step 6: Create Server with Key‑Pair Authentication
POST /v2.1/{project_id}/servers with body:
{
"server":{
"flavorRef":"c1.large",
"name":"zttestvm1",
"block_device_mapping_v2.1":[{
"source_type":"image",
"destination_type":"volume",
"volume_type":"SATA",
"volume_size":"40",
"delete_on_termination":"true",
"uuid":"11e8f727-d439-4ed1-b3b8-33f46c0379c4",
"boot_index":"0"
}],
"networks":[{"uuid":"fb68519f-a7c0-476e-98d4-2e4cf6de6def"}],
"key_name":"demo2",
"availability_zone":"az_test_01"
}
}Response example includes id and adminPass.
Step 7: Set Password Login
For non‑cloud‑init images, include adminPass in the server creation request. For cloud‑init images, use user_data (Base64‑encoded) for Linux or admin_pass metadata for Windows.
Step 8: Create Server with Password Authentication
Example request for password login:
{
"server":{
"flavorRef":"c1.large",
"name":"zttestvm1",
"adminPass":"NOVAGLANCEI@123",
"block_device_mapping_v2.1":[{...same as above...}],
"networks":[{"uuid":"fb68519f-a7c0-476e-98d4-2e4cf6de6def"}],
"availability_zone":"az_test_01"
}
}Step 9: Confirm Server Creation
GET /v2.1/{project_id}/servers/{server_id} to retrieve server details and verify status is ACTIVE.
Response includes server metadata, addresses, flavor, image, and status.
After following these steps, I successfully launched the cloud server and discovered Huawei Cloud API Explorer, which provides a ready‑to‑use environment for testing APIs, greatly simplifying future development.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Huawei Cloud Developer Alliance
The Huawei Cloud Developer Alliance creates a tech sharing platform for developers and partners, gathering Huawei Cloud product knowledge, event updates, expert talks, and more. Together we continuously innovate to build the cloud foundation of an intelligent world.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
