All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Instance metadata

Last updated:2021-08-04 11:26:31

Instance metadata refers to the configuration information related to KEC and EPC instances, such as NICs, instance names, and IP addresses. It can be used to configure and manage running instances.

This topic describes how to query instance metadata in Linux operating systems and explains each item of the metadata.

Query instance metadata

  1. Connect to the instance.
  2. Access the root directory of the metadata.

    curl http://global.cloudinit.sdns.ksyun.com:8775/latest/meta-data/
  3. Add metadata item names to URLs to obtain detailed information about the corresponding metadata. Common metadata items:

    • Obtain the instance ID.

      curl http://global.cloudinit.sdns.ksyun.com:8775/latest/meta-data/instance-id
    • Obtain the operating system name of the instance.
      curl http://global.cloudinit.sdns.ksyun.com:8775/latest/meta-data/hostname
    • Obtain the instance type, such as KEC or EPC.
      curl http://global.cloudinit.sdns.ksyun.com:8775/latest/meta-data/host-type
    • Obtain the image ID used by the instance.
      curl http://global.cloudinit.sdns.ksyun.com:8775/latest/meta-data/image-id
    • Obtain the NIC ID used by the instance.
      curl http://global.cloudinit.sdns.ksyun.com:8775/latest/meta-data/mac
  4. (Optional) View custom data. The command is only supported by KEC instances.
    curl http://global.cloudinit.sdns.ksyun.com:8775/latest/user-data

Description of metadata

Name of metadata item Description of metadata item
hostname Name of the host (name of operating system)
host-type Instance type
instance-id Instance ID
image-id Image ID
vpc-id ID of the VPC where the primary NIC resides
subnet-id ID of the subnet where the primary NIC resides
securitygroup-ids ID of the security group to which the primary NIC belongs
mac MAC address of the primary NIC
placement/region Region of the instance
placement/zone Availability zone of the instance
local-ipv4 IPv4 address of the primary NIC
local-ipv6 IPv6 address of the primary NIC
public-ipv4 Elastic IP address of the primary NIC
network/interfaces/macs MAC addresses of instance NICs
network/interfaces/macs/mac/vpc-id ID of the VPCs where NICs reside
network/interfaces/macs/mac/subnet-id IDs of the subnets where NICs reside
network/interfaces/macs/mac/gateway Gateway addresses of NICs
network/interfaces/macs/mac/local-ipv4 IPv4 addresses of NICs
network/interfaces/macs/mac/local-ipv6 IPv6 addresses of NICs
network/interfaces/macs/mac/public-ipv4 Elastic IP addresses of NICs
network/interfaces/macs/mac/securitygroup-ids IDs of the security groups to which NICs belong
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback