Forum Stats

  • 3,826,865 Users
  • 2,260,714 Discussions


OCI Utilities Enhancements (oci-metadata)

Oracle Linux instances created using Oracle-Provided Images include a pre-installed set of utilities that is designed to facilitate configuration tasks for Oracle Linux 7 instances on Oracle Cloud Infrastructure (OCI).  These utilities consist of a set command line tools provided in the oci-utils RPM package that is pre-installed with the latest Oracle Linux 7 images provided under the ‘Oracle-Provided OS Image’ selection when creating an instance from the Oracle Cloud Infrastructure console. 

One such command line tool is oci-metadata, which queries instance metadata such as the OCI region, availability domain, shape, state, OCID, compartment, and network. 

As of the January 2019 OCI Oracle Linux 7.6 and 7.6 GPU images for Oracle Cloud Infrastructure (dated 2019.01.17), a new release of oci-utils 0.8.0-4 was included in the images.  This version of oci-utils includes enhancements to the oci-metadata command line tool to allow users to easily parse, display, export, and update metadata information.

The oci-metadata synopsis is as follows with the new options in highlighted in red:

oci-metadata  [-h|--human-readable]  [-j|--json]  [-g KEY  | --get KEY ] [-u KEY=VALUE [KEY=VALUE, ...] | --update KEY=VALUE [KEY=VALUE, ...]  ] [--export] [--trim] [--help] [-i|--instance-id OCID ]


–Update instance metadata keys for a specified instance


–Used with the -g option, print a shell command to export the keys as environment variables


–Used with the -g option, trim the key path to the last component e.g. 'instance/metadata/ssh_authorized_keys/' to 'ssh_authorized_keys'

--instance-id <ocid>, -I OCID

–Get or update the metadata of the instance with the given OCID.

-g /path/to/key -g /path/*/key

–Support for path and wildcard in metadata path

For more information visit: