OCI Utilities

Instances using Oracle Linux platform images include a set of utilities (oci-utils) that let the instance 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

Oracle Linux instances come with the Oracle Cloud Infrastructure (OCI) utilities (oci-utils) package installed. These utilities aren't available on other distributions.

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

  • The oci_included repository is enabled. This repository is enabled by default in Oracle Linux platform images. The repository contains all required packages, including the required OCI SDK and Python packages. The oci-utils package provides all the dependencies.
  • The OCI utilities have the required permissions to access Oracle Cloud Infrastructure. This can be achieved 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 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 has access to Oracle Cloud Infrastructure services. For more information, see Managing Dynamic Groups.
    • Configure oci-utils to let the root account use a unprivileged user's OCI configuration files. For more information, see the configuration file in the instance's /etc/oci-utils.conf.d directory.
  • After ensuring that the OCI utilities have the necessary permissions, select which of the following methods to use to access the utilities and perform any required setup for that method:

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

Updating the OCI Utilities

To update to the latest version of oci-utils, run the following command:

sudo dnf update oci-utils

Using the ocid Daemon

The ocid daemon is the service component of oci-utils. It monitors 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 immediately using systemd and start automatically when the system boots, run the following command:

sudo systemctl enable --now ocid.service

To confirm that the service is active (running), run the following command:

sudo service ocid status

The output is similar to the following:

$ 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; preset: disabled)
     Active: active (running) since date and time; 9s ago
 Invocation: edd65c2c534949f3a3fb1a77d0aecccf
   Main PID: 361841 (python3)
      Tasks: 4 (limit: 72765)
     Memory: 127.3M (peak: 127.8M)
        CPU: 1.424s
     CGroup: /system.slice/ocid.service
             └─361841 /usr/bin/python3 /usr/lib/python3.12/site-packages/oci_utils/impl/ocid_main.py --no-daemon
date and time hostname systemd[1]: Starting ocid.service - Oracle Cloud Infrastructure utilities daemon...
date and time hostname systemd[1]: Started ocid.service - Oracle Cloud Infrastructure utilities daemon.

        

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 Configures iSCSI devices attached to a compute instance. If no command line options are specified, it lists any devices that need attention.
oci-metadata Displays metadata for the compute instance. If no command line options are specified, this 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 specific 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 further define what type of information is produced by the utility, or how a task is performed.

The following table lists the options, and their possible 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 possible 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 output is displayed. The following options are available:

  • 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 view the 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