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.

  3. Add metadata item names to URLs to obtain detailed information about the corresponding metadata. Common metadata items:

    • Obtain the instance ID.

    • Obtain the operating system name of the instance.

    • Obtain the instance type, such as KEC or EPC.

    • Obtain the image ID used by the instance.

    • Obtain the NIC ID used by the instance.

  4. (Optional) View custom data. The command is only supported by KEC instances.


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

Did you find the above information helpful?

Mostly Unhelpful
A little helpful
Very helpful

What might be the problems?

Unclear or awkward
Redundant or clumsy
Lack of context for the complex system or functionality

More suggestions


Please give us your feedback.


Thank you for your feedback.