Oracle Cloud Infrastructure Documentation

Getting Instance Metadata

The metadata for an instance includes information such as the instance's An Oracle-assigned unique ID called an Oracle Cloud Identifier (OCID). This ID is included as part of the resource's information in both the Console and API., display name, region, One or more isolated, fault-tolerant Oracle data centers that host cloud resources such as instances, volumes, and subnets. A region contains one or more availability domains., A logical grouping of hardware and infrastructure within an availability domain to provide isolation of resources in case of hardware failure or unexpected software changes., A collection of related resources that can be accessed only by certain groups that have been given permission by an administrator in your organization., A template that determines the number of CPUs and the amount of memory allocated to a newly created instance., A template of a virtual hard drive that determines the operating system and other software for an instance., creation date, state, tags, and any custom metadata that you provide, such as an SSH public key. The instance metadata also includes the region identifier for an instance, such as us-phoenix-1, in the canonicalRegionName field.

You can find some of this information in the Console on the Instance Details page, or you can get all of it by logging in to the instance and using the metadata service. The service runs on every instance and is an HTTP endpoint listening on 169.254.169.254.

Required IAM Policy

No IAM policy is required if you're logged in to the instance and using cURL to get the metadata (see below).

For administrators: Users can also get instance metadata through the Compute API (for example, with GetInstance). The policy in Let users launch Compute instances covers that ability. If the specified group doesn't need to launch instances or attach volumes, you could simplify that policy to include only manage instance-family, and remove the statements involving volume-family and virtual-network-family.

If you're new to policies, see Getting Started with Policies and Common Policies. For reference material about writing policies for instances, cloud networks, or other Core Services API resources, see Details for the Core Services.

Accessing Instance Metadata on Oracle-Provided Images

You can get instance metadata for Oracle-provided images by using cURL on Linux instances or an internet browser on Windows instances. For more information about the format of the data that is returned, see Instance.

Using cURL to Get Linux Instance Metadata
Using an Internet Browser to Get Windows Instance Metadata