Accessing the Metadata and User Data of a VM

You can get information about the configuration of virtual machine (VM) by accessing metadata and user data from within the VM itself.

This action enables you to access information that would otherwise be inaccessible inside the VM.

You can also get this information from outside the VM. For more information, see Getting Information About Your VMs.

Accessing the Metadata of a VM

Before you begin: Access the VM whose metadata you want to access. For more information, see Accessing Your VMs.

To access the metadata of a VM, type the following command in a terminal of the VM, where CATEGORY is any of the category or category/subcategory available:

Request sample
$ curl http://169.254.169.254/latest/meta-data/CATEGORY

You can also type the address http://169.254.169.254/latest/meta-data/CATEGORY in a web browser.

CATEGORY Description

ami-id

The ID of the OUTSCALE machine image (OMI) used to create the VM.

ami-launch-index

The creation index of the VM. For more information, see About VMs > General Information About VMs.

block-device-mapping/

This category contains the following subcategories:

  • ami: The device name of the root device of the VM.

  • ebsN: The device name of any additional volume attached to the VM, where N is an index starting from 1.

  • root: Same as ami.

hostname

The primary private DNS of the VM.

instance-id

The ID of the VM.

instance-type

The type of VM.

local-hostname

Same as hostname.

local-ipv4

The primary private IP of the VM.

mac

The primary Media Access Control (MAC) address of the VM.

network/interfaces/macs/

A list of MAC addresses associated with the VM.

network/interfaces/macs/MAC_ADDRESS/

This category contains the following subcategories, where MAC_ADDRESS is any MAC address associated with the VM:

  • device-number: The number of the ethernet device for the network interface.

  • gateway-ipv4: The private IP for the gateway.

  • interface-id: The ID of the network interface.

  • ipv4-associations/PUBLIC_IP: The private IP associated with the PUBLIC_IP address of the network interface.

  • local-hostname: The private DNS for the network interface.

  • local-ip4s: The private IP for the network interface.

  • mac: The MAC address for the network interface.

  • owner-id: The account ID of the owner of the network interface.

  • public-hostname: The public DNS, if any, for the network interface.

  • public-ipv4s: The public IP for the network interface.

  • security-group-ids: A list of security group IDs for the network interface.

  • security-groups: A list of security group names for the network interface.

  • subnet-id: The ID of the Subnet for the network interface.

  • subnet-ipv4-cidr-block: In a Net, a range of IPs for the Subnet, in CIDR notation.

  • vpc-id: In a Net, the ID of the Net for the network interface.

placement/

This category contains the following subcategories:

  • availability-zone: The Subregion where the VM is.

  • server: The server where the VM is.

  • cluster: The cluster where the VM is.

public-hostname

The public DNS of the VM.

public-keys/0/openssh-key

The public part of the keypair for the VM. For more information, see About Keypairs.

reservation-id

The ID of the reservation the VM is associated with.

security-groups

A list of security group names for the VM. For more information, see About Security Groups.

tags/

A list of tags associated with the VM. For more information, see About Tags.

tags/KEY_NAME

The tag Value corresponding to the KEY_NAME tag Key.

The requested metadata of the VM appears.

Accessing the User Data of a VM

Before you begin: Access the VM whose user data you want to access. For more information, see Accessing Your VMs.

To access the user data of a VM, type the following command in a terminal of the VM:

Request sample
$ curl http://169.254.169.254/latest/user-data

You can also type the address http://169.254.169.254/latest/user-data in a web browser.

The user data of the VM appears.

Related Pages