OCI Utilities

Instances using Oracle Linux platform images include a set of utilities (oci-utils) that allow the instance to access information about infrastructure resources. These utilities consist of a service component and command line tools that help automatically discover or provision resources.

Installing the OCI Utilities

Instances launched with Oracle Linux 7 or later automatically include the Oracle Cloud Infrastructure (OCI) utilities (oci-utils) package installed. The utilities aren't available on other distributions.

To use the OCI utilities, you must meet the following prerequisites:

  • Ensure that the oci_included repository is enabled. This repository is enabled by default in Oracle Linux platform images. This repository contains all package dependencies, including the required OCI SDK and Python packages. All required packages are installed with the oci-utils package.
  • Ensure that the OCI utilities have sufficient permissions to access Oracle Cloud Infrastructure by doing one of the following:
    • Create the SDK configuration file for the host. For more information, see SDK and CLI Configuration File.
      Note

      You might need to install the CLI for your environment before running the oci setup config command to create the SDK configuration file. For more information, see Installing the CLI.
    • Use instance principals by adding the instance to a dynamic group that was granted access to Oracle Cloud Infrastructure services. For more information, see Managing Dynamic Groups.
    • Configure oci-utils to allow root to use a non-privileged user's Oracle Cloud Infrastructure configuration files. For more information, see the configuration file located in the /etc/oci-utils.conf.d directory of the instance.
  • Choose the method to access the utilities, and perform any setup procedures for that method, as needed:

For a video on how to install and set up the OCI utilities, see Enabling OCI Utilities in Oracle Linux on Oracle Cloud Infrastructure Instances in the Oracle Linux Training Station.

Updating the OCI Utilities

To update to the latest version of oci-utils:

sudo yum update oci-utils

Using the ocid Daemon

The ocid daemon is the service component of the oci-utils. It monitors for changes in the VNIC and iSCSI configuration of the instance and tries to automatically attach or detach devices as they appear or disappear - for example, when they're created or deleted using the Oracle Cloud Infrastructure Console, CLI, or the API.

To start the ocid daemon using systemd and set the ocid service to start automatically during system boot:

sudo systemctl enable --now ocid.service

To confirm that the service is active (running):

sudo service ocid status

For example:

$ sudo service ocid status
Redirecting to /bin/systemctl status ocid.service
  ocid.service - Oracle Cloud Infrastructure utilities daemon
   Loaded: loaded (/etc/systemd/system/ocid.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-02-04 18:01:25 GMT; 1min 42s ago
 Main PID: 16630 (python3)
   CGroup: /system.slice/ocid.service
           └─16630 /usr/bin/python3 /usr/lib/python3.6/site-packages/oci_util...

Feb 04 18:01:23 mor-demoinst-10 systemd[1]: Starting Oracle Cloud Infrastruc....
Feb 04 18:01:24 mor-demoinst-10 sudo[16705]:     root : TTY=unknown ; PWD=/ ...w
Feb 04 18:01:25 mor-demoinst-10 systemd[1]: Started Oracle Cloud Infrastruct....
Hint: Some lines were ellipsized, use -l to show in full.
        

OCI Utilities Summary

A summary of the OCI utilities components.

Name Description
ocid The service component of oci-utils, which runs as a daemon started by systemd. This service scans for changes in the iSCSI and VNIC device configurations and caches the OCI metadata and public IP address of the instance.
oci-compartmentid Displays the Oracle Cloud Identifier(OCID) of the compartment where the instance is running.
oci-growfs Expands the root file system of the instance to its configured size.
oci-image-expand Converts the Oracle Linux Minimal instance to add services and packages of a standard Oracle Linux platform image.
oci-instanceid Displays the OCID of the instance.
oci-iscsi-config Lists or configures iSCSI devices attached to a compute instance. If no command line options are specified, lists devices that need attention.
oci-metadata Displays metadata for the compute instance. If no command line options are specified, lists all available metadata. Metadata includes the instance OCID, display name, compartment, shape, region, availability domain, creation date, state, image, and any custom metadata that you provide, such as an SSH public key.
oci-network-config Lists or configures virtual network interface cards (VNICs) attached to the compute instance. When a secondary VNIC is provisioned in the cloud, it must be explicitly configured on the instance using this script or similar commands.
oci-network-inspector Displays a detailed report for a given compartment or network.
oci-notify Sends a message to a Notification service topic.
oci-public-ip Displays the public IP address of the current system in either human-readable or JSON format.
oci-volume-data Displays data about a specific iSCSI volume attached to the instance.

Common OCI Utility Options

Many of the Oracle Cloud Infrastructure (OCI) utilities have the same options, or arguments, available when the utilities are run from the command line. These options and arguments help to further define what type of information is produced by the utility, or how a utility task is performed.

The following table lists the options, and their supported values, that are common across the OCI utilities.

Option Description
--help Displays help information about the utility, such as the utility usage, available options, and the supported values for each option. For example, to view the help for the oci-metadata utility:
$ sudo oci-metadata --help

usage: oci-metadata [-h] [-j] [-g KEY] [--value-only] [--export] [--trim]
                    [-u KEY=VALUE  [KEY=VALUE  ...]] [-i OCID] [--help]

Utility for displaying metadata for an instance running in the Oracle Cloud
Infrastructure.

optional arguments:
  -h, --human-readable  Display human readable output (default)
  -j, --json            Display json output
  ...
  --help                Display this help

--all

Shows all items, or values, in the output.

--details

Shows detailed information in the output.

--output-mode

Lets you define how the utility output is displayed. The following are the available OCI utility modes:

  • json: Displays the output in JSON format.
  • human-readable: Displays the output in human readable format.
  • parsable: Displays the output in parsable format.
  • table: Displays the output in a table.
  • text: Displays textual output.

--no-truncate

Doesn't shorten the values in the displayed output.

--truncate

Shortens the values in the displayed output.

-y| --yes

Answers "yes" at all prompts.

-n | --no

Answers "no" at all prompts.

-q | --quiet

Suppresses information messages.

Note

You can also view man pages for each OCI utility by entering man oci-utility at the command line. For example, to display the built-in manual pages for the oci-metadata utility:
man oci-metadata