Accessing the Metadata and User Data of an Instance

You can get information about the configuration of instance by accessing metadata and user data from within the instance itself.

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

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

Accessing the Metadata of an Instance

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

To access the metadata of an instance, type the following command in a terminal of the instance, 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 launch the instance.

ami-launch-index

The launch index of the instance. For more information, see About Instances > General Information About Instances.

block-device-mapping/

This category contains the following subcategories:

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

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

  • root: Same as ami.

hostname

The primary private DNS of the instance.

instance-id

The ID of the instance.

instance-type

The type of instance.

local-hostname

Same as hostname.

local-ipv4

The primary private IP of the instance.

mac

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

network/interfaces/macs/

A list of MAC addresses associated with the instance.

network/interfaces/macs/MAC_ADDRESS/

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

  • 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 (or External IP, if any) 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 VPC, a range of IPs for the subnet, in CIDR notation.

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

placement/

This category contains the following subcategories:

  • availability-zone: The Availability Zone where the instance is.

  • server: The server where the instance is.

  • cluster: The cluster where the instance is.

public-hostname

The public DNS of the instance.

public-keys/0/openssh-key

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

reservation-id

The ID of the reservation the instance is associated with.

security-groups

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

tags/

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

tags/KEY_NAME

The tag Value corresponding to the KEY_NAME tag Key.

The requested metadata of the instance appears.

Accessing the User Data of an Instance

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

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

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 instance appears.

Related Pages