The metadata of an ECS instance includes the instance ID, IP address, and the OS running on the instance. You can use metadata to manage and configure an instance.

Limits

Metadata is only applicable to VPC instances.
Note If you manually change instance information, your changes will not be indicated in the instance metadata.

Obtain the metadata of a Windows instance

  1. Connect the instance remotely. For more information, see Overview.
  2. Run the Invoke-RestMethod http://100.100.100.200/latest/meta-data/ command on PowerShell to access the metadata information.
  3. Add the specific metadata names to the preceding command to access the specified metadata. For more information, see Instance metadata and Dynamic instance metadata. For example:
    • Run the Invoke-RestMethod http://100.100.100.200/latest/meta-data/instance-id command to obtain the ECS instance ID.

    • Run the Invoke-RestMethod http://100.100.100.200/latest/meta-data/image-id command to obtain the image ID of the ECS instance.

Obtain the metadata of a Linux instance

  1. Connect to the instance remotely. For more information, see Overview.
  2. Run the curl http://100.100.100.200/latest/meta-data/ command to access the root directory of the metadata.
  3. Add the specific metadata names to the preceding command to access the specified metadata. For more information, see Instance metadata and Dynamic instance metadata. For example:
    • Run the curl http://100.100.100.200/latest/meta-data/instance-id command to obtain the ECS instance ID.

    • Run the curl http://100.100.100.200/latest/meta-data/image-id command to obtain the image ID of the ECS instance.

Instance metadata

The following table lists all metadata that you can obtain from an ECS instance.

Metadata Description Version
/dns-conf/nameservers The DNS configurations of an instance 2016-01-01
/eipv4 The EIP address (IPv4 type) mounted to the primary ENI of an instance 2016-01-01
/hostname The host name of an instance 2016-01-01
/instance/instance-type The type of an instance 2016-01-01
/image-id The ID of the image selected when an instance was created 2016-01-01
/image/market-place/product-code The product code of an image in the Alibaba Cloud Marketplace 2016-01-01
/image/market-place/charge-type The billing method of an image in the Alibaba Cloud Marketplace 2016-01-01
/instance-id The ID of an instance 2016-01-01
/mac The MAC address of an instance. If an instance has more than one ENIs, this metadata indicates only the MAC address of eth0. 2016-01-01
/network-type The network type. Only VPCs are supported. 2016-01-01
/network/interfaces/macs The MAC address list of ENIs 2016-01-01
/network/interfaces/macs/[mac]/network-interface-id The unique ID of the ENI. The [mac] parameter must be replaced with the actual MAC address. 2016-01-01
/network/interfaces/macs/[mac]/netmask The subnet mask of the ENIs 2016-01-01
/network/interfaces/macs/[mac]/vswitch-cidr-block The IPv4 CIDR block of the VSwitch to which the ENIs belong 2016-01-01
/network/interfaces/macs/[mac]/vpc-cidr-block The IPv4 CIDR block of the VPC to which the ENIs belong 2016-01-01
/network/interfaces/macs/[mac]/private-ipv4s The private IPv4 addresses assigned by the ENIs 2016-01-01
/network/interfaces/macs/[mac]/vpc-ipv6-cidr-blocks The IPv6 CIDR block of the VPC to which the ENIs belong. Only VPC instances configured with IPv6 are supported. 2016-01-01
/network/interfaces/macs/[mac]/vswitch-id The VSwitch ID of the security group to which the ENIs belong 2016-01-01
/network/interfaces/macs/[mac]/vpc-id The VPC ID of the security group to which the ENIs belong 2016-01-01
/network/interfaces/macs/[mac]/primary-ip-address The primary private IP address of the ENIs 2016-01-01
/network/interfaces/macs/[mac]/gateway The IPv4 gateway address of the ENIs 2016-01-01
/instance/max-netbw-egress The maximum egress intranet bandwidth (in Kbit/s) of the instance type 2016-01-01
/instance/max-netbw-ingress The maximum ingress intranet bandwidth (in Kbit/s) of the instance type 2016-01-01
/network/interfaces/macs/[mac]/ipv6s The IPv6 addresses assigned by the ENIs. Only VPC instances configured with IPv6 are supported. 2016-01-01
/network/interfaces/macs/[mac]/ipv6-gateway The IPv6 gateway address of the VPC to which the ENIs belong 2016-01-01
/network/interfaces/macs/[mac]/vswitch-ipv6-cidr-block The IPv6 CIDR block of the VSwitch to which the ENIs belong. Only VPC instances configured with IPv6 are supported. 2016-01-01
/private-ipv4 The private IPv4 address of the primary ENI of an instance 2016-01-01
/public-ipv4 The Internet IPv4 address of the primary ENI of an instance 2016-01-01
/ntp-conf/ntp-servers The address of an NTP server 2016-01-01
/owner-account-id The Alibaba Cloud account ID of the instance owner 2016-01-01
/public-keys A list of all public keys of the current instance 2016-01-01
/region-id The region to which an instance belongs 2016-01-01
/zone-id The ID of the zone to which an instance belongs 2016-01-01
/serial-number The serial number of an instance 2016-01-01
/source-address The image library from which the package management software of a Linux instance obtains updates. The source is usually a YUM or APT source. 2016-01-01
/kms-server The server that activates the KMS of a Windows instance 2016-01-01
/wsus-server/wu-server The server that updates a Windows instance 2016-01-01
/wsus-server/wu-status-server The server that monitors the update status of an Windows instance 2016-01-01
/vpc-id The ID of the VPC to which an instance belongs 2016-01-01
/vpc-cidr-block The CIDR block of the VPC to which an instance belongs 2016-01-01
/vswitch-cidr-block The CIDR block of the VSwitch to which an instance belongs 2016-01-01
/vswitch-id The ID of the VSwitch to which an instance belongs 2016-01-01
/ram/security-credentials/[role-name] The temporary STS credential generated according to the policy of a RAM role. This credential is available only after you attach a RAM role to an ECS instance. The [role-name] parameter must be replaced with the actual RAM role name.
Note A new STS credential is available 30 minutes prior to the expiry of the old one. During this period, both STS credentials can be used.
2016-01-01
/instance/spot/termination-time The stop and release time set in the OS of a preemptible instance. The time is specified in UTC+0 format (yyyy-MM-ddThh:mm:ssZ), for example, 2018-04-07T17:03:00Z. 2016-01-01
/instance/virtualization-solution The ECS virtualization solution, which can be ECS Virt 1.0 or Virt 2.0 2016-01-01
/instance/virtualization-solution-version The internal Build version 2016-01-01
/instance-identity/pkcs7 The instance identity signature 2016-01-01

Dynamic instance metadata

You can obtain the dynamic metadata of an instance. Dynamic instance metadata refers to data generated after an instance is started for the first time. The following dynamic metadata is supported:

  • O&M metadata: You can obtain the dynamic metadata relating to active System events.
    • For Windows instances, run the following command:
      Invoke-RestMethod http://100.100.100.200/latest/maintenance/active-system-events
    • For Linux instances, run the following command:
      curl http://100.100.100.200/latest/maintenance/active-system-events
  • Identity metadata: You can obtain the dynamic metadata relating to Instance identity.
    • For Windows instances, run the following command:
      Invoke-RestMethod http://100.100.100.200/latest/dynamic/instance-identity/document
    • For Linux instances, run the following command:
      curl http://100.100.100.200/latest/dynamic/instance-identity/document
  • Configuration metadata: You can obtain the dynamic metadata relating to User data.
    • For Windows instances, run the following command:
      Invoke-RestMethod http://100.100.100.200/latest/user-data
    • For Linux instances, run the following command:
      curl http://100.100.100.200/latest/user-data