Docs
uhost
How Tos
Metadata
Metadata Server

Metadata

Metadata is a collection of basic information about the UHost cloud host, including host id, configuration, image, ip, etc. All relevant metadata of the instance can be obtained through the metadata server.

Metadata Server

The metadata server is an intranet service. Through this service, you can obtain the self-information of the current cloud host instance within the host.

The metadata server address for UCloud-Global is (consistent across all available zones):

http://100.80.80.80/meta-data/

Metadata Item

(Compared to:http://100.80.80.80/meta-data/latest/uhost (opens in a new tab)

Metadata ItemDescription
/project-idProject ID
/regionRegion
/zoneAvailability Zone
/uhost-idUHost ID
/nameUHost Name
/remarkUHost Remark
/tagUHost Business Group
/image-idImage ID
/os-nameImage Operating System Name
/machine-typeMachine Type
/cpuNumber of CPUs
/memoryMemory Capacity (MB)
/gpuNumber of GPUs
/isolation-groupHardware Isolation Group ID
/net-capabilityNetwork Enhancement Features
/hotplugHot Upgrade Features
/disks/N/(Array) Disk
/disks/N/disk-idDisk ID
/disks/N/nameDisk Name
/disks/N/is-bootIs it a System Disk
/disks/N/disk-typeDisk Type
/disks/N/sizeDisk Capacity (GB)
/disks/N/driveDisk Drive
/disks/N/encryptedIs it an Encrypted Disk
/disks/N/backup-typeBackup Type
/network-interfaces/N/(Array) Virtual Network Interface
/network-interfaces/N/vpc-idVPC ID
/network-interfaces/N/subnet-idSubnet ID
/network-interfaces/N/macMAC Address
/network-interfaces/N/ips/N/(Array) IP Address
/network-interfaces/N/ips/N/ip-id(Only valid when it is an EIP) EIP ID
/network-interfaces/N/ips/N/ip-addressIP Address
/network-interfaces/N/ips/N/typeIP Type
/network-interfaces/N/ips/N/widthBandwidth Size (MB)

View Metadata

You can obtain the corresponding project information under the relevant directory level of the metadata server through the following command:

[root@192-168-1-1]# curl http://100.80.80.80/meta-data/latest/uhost/uhost-id

uhost-vjfsj2db

You can obtain the corresponding directory hierarchy of the metadata server through the following command:

[root@192-168-1-1]# curl http://100.80.80.80/meta-data/latest/uhost/disks/0/

/backup-type 
/encrypted 
/disk-id
/disk-type
/drive
/is-boot
/name
/size

Combining Cloud-Init

The following example is a piece of user-defined data (user-data) writing method, the purpose of which is to automatically report the host id information to the server (1.2.3.4) after the host is created and available:

#!/bin/sh
md=http://100.80.80.80/meta-data/v1
myserver=http://1.2.3.4/
ID=$(curl -s $md/instance-id)
curl -s $myserver/?id=$ID