docs
uhost
Operation Guide
Metadata and Custom Data
Metadata

Metadata

Metadata refers to a collection of essential information about a cloud host UHost, including host id, configuration, imaging, ip, etc. All related metadata of an instance can be acquired through a metadata server.

Metadata Server

The metadata server is an intranet service. It allows retrieval of the current cloud host instance's self-information within the host.

The Metadata Server address for SurferCloud (consistent across all available zones) is:

http://100.80.80.80/meta-data/

Metadata Items

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

Metadata ItemsDescription
/project-idProject ID
/regionRegion
/zoneAvailable 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-capabilityEnhanced Network Feature
/hotplugHot Upgrade Feature
/disks/N/(Array) Disk
/disks/N/disk-idDisk id
/disks/N/nameDisk Name
/disks/N/is-bootIs System Disk
/disks/N/disk-typeDisk Type
/disks/N/sizeDisk Capacity (GB)
/disks/N/driveDisk Drive Letter
/disks/N/encryptedIs Encrypted Disk
/disks/N/backup-typeBackup Type
/network-interfaces/N/(Array) Virtual Network Interface Cards
/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 for 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

The following command can be used to obtain corresponding project information under the related directory level of the metadata server:

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

uhost-vjfsj2db

The following command can be used to obtain the corresponding directory level of the metadata server:

[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 with Cloud-Init

The following example shows the writing of user-defined data (user-data) with the objective of automatically reporting host id information to the server (1.2.3.4) once 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
  • Company
  • ContactUs
  • Blog
Copyright © 2024 SurferCloud All Rights Reserved