Configure Oracle Cloud Infrastructure (OCI) CLI

The Oracle Cloud can be accessed with its web console or on the command-line using the OCI CLI. In this blog post, I will show the required steps to install it and to link it with your Oracle Cloud tenant.

Requirements

To access the Oracle Cloud using the OCI CLI, you need a user which is able to use API keys. Navigate to the user settings of your user account to verify this.

Oracle Cloud user settings

The API key can be generated manually or automatically during the configuration. If an already existing API key is used, the private key file has to be uploaded to the server/client. For the case that a API key is generated, the generated public key file has to be uploaded to the Oracle Cloud.

Installation

To install the OCI CLI, download the wrapper script install.sh for Linux/Unix or install.ps1 for Windows from the GitHub repository oracle / oci-cli and execute it on your server/client. The wrapper script will download the Python script install.py.

If Python is not installed on your system, the wrapper script will download and install it automatically.

Python not found on system PATH
-bash: /usr/bin/python3: No such file or directory
System version of Python must be a Python 3 version >= 3.5.0.
/usr/bin/yum
Attempting to install Python 3.

During my tests, the build and make of Python failed. So I installed it manually before running the install script.

$> yum install python3

Per default, the script is executed in interactive mode. If you want to run it unattended, provide the parameter –accept-all-defaults to use default values or use the existing parameters (https://github.com/oracle/oci-cli/tree/master/scripts/install) to override them.

Linux / Unix

As installation directory I use $ORACLE_BASE/tools/oci-cli. But you can placed it wherever you want.

$> wget https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh
$> mkdir -p $ORACLE_BASE/tools/oci-cli
$> . ./install.sh

    ******************************************************************************
    You have started the OCI CLI Installer in interactive mode. If you do not wish
    to run this in interactive mode, please include the --accept-all-defaults option.
    If you have the script locally and would like to know more about
    input options for this script, then you can run:
    ./install.sh -h
    If you would like to know more about input options for this script, refer to:
    https://github.com/oracle/oci-cli/blob/master/scripts/install/README.rst
    ******************************************************************************
Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/v2.14.4/scripts/install/install.py to /tmp/oci_cli_install_tmp_Dcjm.
####################################################################################################################################################### 100.0%
Python not found on system PATH
Running install script.
python3 /tmp/oci_cli_install_tmp_Dcjm
-- Verifying Python version.
-- Python version 3.6.8 okay.

===> In what directory would you like to place the install? (leave blank to use '/home/oracle/lib/oracle-cli'): /u00/app/oracle/tools/oci-cli/lib
-- Creating directory '/u00/app/oracle/tools/oci-cli/lib'.
-- We will install at '/u00/app/oracle/tools/oci-cli/lib'.

===> In what directory would you like to place the 'oci' executable? (leave blank to use '/home/oracle/bin'): /u00/app/oracle/tools/oci-cli/bin
-- Creating directory '/u00/app/oracle/tools/oci-cli/bin'.
-- The executable will be in '/u00/app/oracle/tools/oci-cli/bin'.

===> In what directory would you like to place the OCI scripts? (leave blank to use '/home/oracle/bin/oci-cli-scripts'): /u00/app/oracle/tools/oci-cli/bin/oci-cli-scripts
-- Creating directory '/u00/app/oracle/tools/oci-cli/bin/oci-cli-scripts'.
-- The scripts will be in '/u00/app/oracle/tools/oci-cli/bin/oci-cli-scripts'.

===> Currently supported optional packages are: ['db (will install cx_Oracle)']
What optional CLI packages would you like to be installed (comma separated names; press enter if you don't need any optional packages)?: db
-- The optional packages installed will be 'db'.
-- Trying to use python3 venv.
-- Executing: ['/usr/bin/python3', '-m', 'venv', '/u00/app/oracle/tools/oci-cli/lib']
-- Executing: ['/u00/app/oracle/tools/oci-cli/lib/bin/pip', 'install', '--upgrade', 'pip']
Collecting pip
  Using cached https://files.pythonhosted.org/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-21.0.1
-- Executing: ['/u00/app/oracle/tools/oci-cli/lib/bin/pip', 'install', '--cache-dir', '/tmp/tmp56oydzly', 'wheel', '--upgrade']
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
Successfully installed wheel-0.36.2
-- Executing: ['/u00/app/oracle/tools/oci-cli/lib/bin/pip', 'install', '--cache-dir', '/tmp/tmp56oydzly', 'oci_cli[db]', '--upgrade']
Collecting oci_cli[db]
  Downloading oci_cli-2.21.4-py2.py3-none-any.whl (13.2 MB)
     |████████████████████████████████| 13.2 MB 12.7 MB/s
Collecting oci==2.32.0
  Downloading oci-2.32.0-py2.py3-none-any.whl (7.7 MB)
     |████████████████████████████████| 7.7 MB 2.4 MB/s
Collecting click==6.7
  Downloading click-6.7-py2.py3-none-any.whl (71 kB)
     |████████████████████████████████| 71 kB 17.8 MB/s
Collecting certifi
  Downloading certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 16.2 MB/s
Collecting pyOpenSSL==19.1.0
  Downloading pyOpenSSL-19.1.0-py2.py3-none-any.whl (53 kB)
     |████████████████████████████████| 53 kB 4.6 MB/s
Collecting PyYAML==5.1.2
  Downloading PyYAML-5.1.2.tar.gz (265 kB)
     |████████████████████████████████| 265 kB 17.5 MB/s
Collecting arrow==0.17.0
  Downloading arrow-0.17.0-py2.py3-none-any.whl (50 kB)
     |████████████████████████████████| 50 kB 10.7 MB/s
Collecting configparser==4.0.2
  Downloading configparser-4.0.2-py2.py3-none-any.whl (22 kB)
Collecting retrying==1.3.3
  Downloading retrying-1.3.3.tar.gz (10 kB)
Collecting jmespath==0.10.0
  Downloading jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting six==1.14.0
  Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting cryptography==3.2.1
  Downloading cryptography-3.2.1-cp35-abi3-manylinux2010_x86_64.whl (2.6 MB)
     |████████████████████████████████| 2.6 MB 2.8 MB/s
Collecting python-dateutil<3.0.0,>=2.5.3
  Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
     |████████████████████████████████| 227 kB 14.3 MB/s
Collecting terminaltables==3.1.0
  Downloading terminaltables-3.1.0.tar.gz (12 kB)
Collecting pytz>=2016.10
  Downloading pytz-2021.1-py2.py3-none-any.whl (510 kB)
     |████████████████████████████████| 510 kB 10.4 MB/s
Collecting cx-Oracle==7.0
  Downloading cx_Oracle-7.0.0-cp36-cp36m-manylinux1_x86_64.whl (675 kB)
     |████████████████████████████████| 675 kB 13.1 MB/s
Collecting cffi!=1.11.3,>=1.8
  Downloading cffi-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (401 kB)
     |████████████████████████████████| 401 kB 12.0 MB/s
Collecting pycparser
  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 13.9 MB/s
Building wheels for collected packages: PyYAML, retrying, terminaltables
  Building wheel for PyYAML (setup.py) ... done
  Created wheel for PyYAML: filename=PyYAML-5.1.2-cp36-cp36m-linux_x86_64.whl size=44105 sha256=3a02686e23470b0e14700132fe5724226886004f5731cdb0f3eaef32ffa6c163
  Stored in directory: /tmp/tmp56oydzly/wheels/d8/9b/e7/75af463b873c119dd444151fc54a8e190c87993593e1fa194a
  Building wheel for retrying (setup.py) ... done
  Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=11429 sha256=0199fc88e3455d05457b53256a8004c12fec77763de87889ea0f103025dfd50c
  Stored in directory: /tmp/tmp56oydzly/wheels/ac/cb/8a/b27bf6323e2f4c462dcbf77d70b7c5e7868a7fbe12871770cf
  Building wheel for terminaltables (setup.py) ... done
  Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15355 sha256=9c6f76038731dc2b30bbca3d338148e74e59d20a20df0e8d4dce27199be8f6c1
  Stored in directory: /tmp/tmp56oydzly/wheels/86/1b/58/c23af2fe683acd8edc15d5a1268f0242be1ff2cf827fe34737
Successfully built PyYAML retrying terminaltables
Installing collected packages: pycparser, six, cffi, cryptography, pytz, python-dateutil, pyOpenSSL, configparser, certifi, terminaltables, retrying, PyYAML, oci, jmespath, click, arrow, oci-cli, cx-Oracle
Successfully installed PyYAML-5.1.2 arrow-0.17.0 certifi-2020.12.5 cffi-1.14.5 click-6.7 configparser-4.0.2 cryptography-3.2.1 cx-Oracle-7.0.0 jmespath-0.10.0 oci-2.32.0 oci-cli-2.21.4 pyOpenSSL-19.1.0 pycparser-2.20 python-dateutil-2.8.1 pytz-2021.1 retrying-1.3.3 six-1.14.0 terminaltables-3.1.0

===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): Y

===> Enter a path to an rc file to update (file will be created if it does not exist) (leave blank to use '/home/oracle/.bashrc'): /home/oracle/.bash_profile
-- Backed up '/home/oracle/.bash_profile' to '/home/oracle/.bash_profile.backup'
-- Tab completion set up complete.
-- If tab completion is not activated, verify that '/home/oracle/.bash_profile' is sourced by your shell.
--
-- ** Run `exec -l $SHELL` to restart your shell. **
--
-- Installation successful.
-- Run the CLI with /u00/app/oracle/tools/oci-cli/bin/oci --help

After resourcing the profile or re-login, check if you can execute the OCI CLI.

$> oci --version
2.21.4

Windows

As installation directory I use D:\Oracle\Tools\oci-cli. But you can placed it wherever you want. Python is downloaded automatically in this example.

PS> Set-ExecutionPolicy RemoteSigned
PS> iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1'))

        ******************************************************************************
        You have started the OCI CLI Installer in interactive mode. If you do not wish
        to run this in interactive mode, please include the -AcceptAllDefaults option.
        If you have the script locally and would like to know more about
        input options for this script, then you can run:
        help .\install.ps1
        If you would like to know more about input options for this script, refer to:
        https://github.com/oracle/oci-cli/blob/master/scripts/install/README.rst
        ******************************************************************************
VERBOSE: No valid Python installation found.

Python is required to run the CLI.
Install Python now? (Entering "n" will exit the installation script)
[Y] Yes  [N] No  [?] Help (default is "Y"): Y
VERBOSE: Downloading Python...
VERBOSE: Download Complete! Installer executable written to: C:\Users\goh\AppData\Local\Temp\tmpEA3F.tmp.exe
VERBOSE: Installing Python to C:\Users\goh\Python...
VERBOSE: Successfully installed Python!
VERBOSE: Downloading install script to C:\Users\goh\AppData\Local\Temp\tmp9CF6.tmp
VERBOSE: C:\Users\goh\Python False    False
VERBOSE: Using Python executable: C:\Users\goh\Python\python.exe to run install script...
VERBOSE: Arguments to python script: "C:\Users\goh\AppData\Local\Temp\tmp9CF6.tmp"
-- Verifying Python version.
-- Python version 3.6.5 okay.
-- Verifying Python version.
-- Python version 3.6.5 okay.

===> In what directory would you like to place the install? (leave blank to use 'C:\Users\goh\lib\oracle-cli'): D:\Oracle\Tools\oci-cli\lib
-- Creating directory 'D:\Oracle\Tools\oci-cli\lib'.
-- We will install at 'D:\Oracle\Tools\oci-cli\lib'.

===> In what directory would you like to place the 'oci.exe' executable? (leave blank to use 'C:\Users\goh\bin'): D:\Oracle\Tools\oci-cli\bin
-- Creating directory 'D:\Oracle\Tools\oci-cli\bin'.
-- The executable will be in 'D:\Oracle\Tools\oci-cli\bin'.

===> In what directory would you like to place the OCI scripts? (leave blank to use 'C:\Users\goh\bin\oci-cli-scripts'): D:\Oracle\Tools\oci-cli\bin\oci-cli-scripts
-- Creating directory 'D:\Oracle\Tools\oci-cli\bin\oci-cli-scripts'.
-- The scripts will be in 'D:\Oracle\Tools\oci-cli\bin\oci-cli-scripts'.

===> Currently supported optional packages are: ['db (will install cx_Oracle)']
What optional CLI packages would you like to be installed (comma separated names; press enter if you don't need any optional packages)?: db
-- The optional packages installed will be 'db'.
-- Trying to use python3 venv.
-- Executing: ['C:\\Users\\goh\\Python\\python.exe', '-m', 'venv', 'D:\\Oracle\\Tools\\oci-cli\\lib']
-- Executing: ['D:\\Oracle\\Tools\\oci-cli\\lib\\Scripts\\pip', 'install', '--cache-dir', 'C:\\Users\\goh\\AppData\\Local\\Temp\\tmpt3fv3pwt', 'oci_cli[db]', '--upgrade']
Collecting oci_cli[db]
  Downloading https://files.pythonhosted.org/packages/cd/a0/4249012833211f7c2ca3c7e8acc71738b574a2f6e9d335fd61ba6ffcf702/oci_cli-2.21.4-py2.py3-none-any.whl (13.2MB)
    100% |████████████████████████████████| 13.2MB 83kB/s
Collecting arrow==0.17.0 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/ca/bc/ebc1afb3c54377e128a01024c006f983d03ee124bc52392b78ba98c421b8/arrow-0.17.0-py2.py3-none-any.whl (50kB)
    100% |████████████████████████████████| 51kB 3.7MB/s
Collecting six==1.14.0 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting terminaltables==3.1.0 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/9b/c4/4a21174f32f8a7e1104798c445dacdc1d4df86f2f26722767034e4de4bff/terminaltables-3.1.0.tar.gz
Collecting jmespath==0.10.0 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/07/cb/5f001272b6faeb23c1c9e0acc04d48eaaf5c862c17709d20e3469c6e0139/jmespath-0.10.0-py2.py3-none-any.whl
Collecting configparser==4.0.2 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/7a/2a/95ed0501cf5d8709490b1d3a3f9b5cf340da6c433f896bbe9ce08dbe6785/configparser-4.0.2-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.5.3 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
    100% |████████████████████████████████| 235kB 3.0MB/s
Collecting pytz>=2016.10 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/70/94/784178ca5dd892a98f113cdd923372024dc04b8d40abe77ca76b5fb90ca6/pytz-2021.1-py2.py3-none-any.whl (510kB)
    100% |████████████████████████████████| 512kB 1.8MB/s                                                                                                                     Collecting retrying==1.3.3 (from oci_cli[db])                                                                                                                                   Downloading https://files.pythonhosted.org/packages/44/ef/beae4b4ef80902f22e3af073397f079c96969c69b2c7d52a57ea9ae61c9d/retrying-1.3.3.tar.gz                                Collecting click==6.7 (from oci_cli[db])                                                                                                                                        Downloading https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl (71kB)                    100% |████████████████████████████████| 71kB 4.9MB/s
Collecting pyOpenSSL==19.1.0 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/9e/de/f8342b68fa9e981d348039954657bdf681b2ab93de27443be51865ffa310/pyOpenSSL-19.1.0-py2.py3-none-any.whl (53kB)
    100% |████████████████████████████████| 61kB 4.5MB/s
Collecting PyYAML==5.1.2 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/76/da/60f8d638d81d64db4ed3c279c22eb3a1eebfcde6130fee678940e603b930/PyYAML-5.1.2-cp36-cp36m-win_amd64.whl (214kB)
    100% |████████████████████████████████| 215kB 3.3MB/s
Collecting certifi (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/5e/a0/5f06e1e1d463903cf0c0eebeb751791119ed7a4b3737fdc9a77f1cdfb51f/certifi-2020.12.5-py2.py3-none-any.whl (147kB)
    100% |████████████████████████████████| 153kB 4.0MB/s
Collecting oci==2.32.0 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/6d/7b/859f16db97e3e2883017ba87a8a0fb100fe80dc95ba4fdf4f9ef58ffdae9/oci-2.32.0-py2.py3-none-any.whl (7.7MB)
    100% |████████████████████████████████| 7.7MB 110kB/s
Collecting cryptography==3.2.1 (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/40/a6/af98eb7ace7f107719d182f226456b4aeabe37b5451ced1a81e024e7b6d4/cryptography-3.2.1-cp36-cp36m-win_amd64.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 586kB/s
Collecting cx-Oracle==7.0; extra == "db" (from oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/8f/e8/1e0bdf2940c7ea6d754ee6e8f2814cfa489c55e1873dbf9c6d3e26d8cd9a/cx_Oracle-7.0.0-cp36-cp36m-win_amd64.whl (184kB)
    100% |████████████████████████████████| 194kB 3.0MB/s
Collecting cffi!=1.11.3,>=1.8 (from cryptography==3.2.1->oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/4e/04/25885ffc576fffe36bae2007c65f481dc886ae828520be94fb629eeed32b/cffi-1.14.5-cp36-cp36m-win_amd64.whl (178kB)
    100% |████████████████████████████████| 184kB 3.0MB/s
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography==3.2.1->oci_cli[db])
  Downloading https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112kB)
    100% |████████████████████████████████| 112kB 4.5MB/s
Installing collected packages: six, python-dateutil, arrow, terminaltables, jmespath, configparser, pytz, retrying, click, pycparser, cffi, cryptography, pyOpenSSL, PyYAML, certifi, oci, cx-Oracle, oci-cli
  Running setup.py install for terminaltables ... done
  Running setup.py install for retrying ... done
Successfully installed PyYAML-5.1.2 arrow-0.17.0 certifi-2020.12.5 cffi-1.14.5 click-6.7 configparser-4.0.2 cryptography-3.2.1 cx-Oracle-7.0.0 jmespath-0.10.0 oci-2.32.0 oci-cli-2.21.4 pyOpenSSL-19.1.0 pycparser-2.20 python-dateutil-2.8.1 pytz-2021.1 retrying-1.3.3 six-1.14.0 terminaltables-3.1.0
You are using pip version 9.0.3, however version 21.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

===> Modify PATH to include the CLI and enable tab completion in PowerShell now? (Y/n): Y
--
-- ** Close and re-open PowerShell to reload changes to your PATH **
-- In order to run the autocomplete script, you may also need to set your PowerShell execution policy to allow for running local scripts (as an Administrator run Set-ExecutionPolicy RemoteSigned in a PowerShell prompt)
--
-- Installation successful.
-- Run the CLI with D:\Oracle\Tools\oci-cli\bin\oci.exe --help
VERBOSE: Successfully installed OCI CLI!

After restarting PowerShell, check if you can execute the OCI CLI.

PS> oci --version
2.21.4

Configuration

To use the OCI CLI, you have to link it to your Oracle Cloud tenant. The following information are required:

  • OCID of the user (ocid1.user.oc1..xxxxxxx)
  • OCID of the tenant (ocid1.tenancy.oc1..xxxxxx)
  • API Signing private key file (optional)

Follow the instructions in the Oracle Cloud Infrastructure Documentation to gather all required information. Afterward, run the configuration wizard.

$> oci setup config
    This command provides a walkthrough of creating a valid CLI config file.

    The following links explain where to find the information required by this
    script:

    User API Signing Key, OCID and Tenancy OCID:

        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#Other

    Region:

        https://docs.cloud.oracle.com/Content/General/Concepts/regions.htm

    General config documentation:

        https://docs.cloud.oracle.com/Content/API/Concepts/sdkconfig.htm


Enter a location for your config [/home/oracle/.oci/config]:
Enter a user OCID: ocid1.user.oc1..xxxxxxx
Enter a tenancy OCID: ocid1.tenancy.oc1..xxxxxxx
Enter a region by index or name(e.g.
1: ap-chiyoda-1, 2: ap-chuncheon-1, 3: ap-hyderabad-1, 4: ap-melbourne-1, 5: ap-mumbai-1,
6: ap-osaka-1, 7: ap-seoul-1, 8: ap-sydney-1, 9: ap-tokyo-1, 10: ca-montreal-1,
11: ca-toronto-1, 12: eu-amsterdam-1, 13: eu-frankfurt-1, 14: eu-zurich-1, 15: me-dubai-1,
16: me-jeddah-1, 17: sa-santiago-1, 18: sa-saopaulo-1, 19: uk-cardiff-1, 20: uk-gov-cardiff-1,
21: uk-gov-london-1, 22: uk-london-1, 23: us-ashburn-1, 24: us-gov-ashburn-1, 25: us-gov-chicago-1,
26: us-gov-phoenix-1, 27: us-langley-1, 28: us-luke-1, 29: us-phoenix-1, 30: us-sanjose-1): 13
Do you want to generate a new API Signing RSA key pair? (If you decline you will be asked to supply the path to an existing key.) [Y/n]: n
Enter the location of your API Signing private key file: /home/oracle/oci.pem
Fingerprint: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Config written to /home/oracle/.oci/config


    If you haven't already uploaded your API Signing public key through the
    console, follow the instructions on the page linked below in the section
    'How to upload the public key':

        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#How2

If you uploaded a private key file, set the correct permissions.

$> oci setup repair-file-permissions --file /home/oracle/oci.pem
$> ls -la /home/oracle/oci.pem
-rw------- 1 oracle oinstall 1730 Feb 18 13:36 /home/oracle/oci.pem

Otherwise OCI CLI will complain about wrong permissions.

WARNING: Permissions on /home/oracle/oci.pem are too open.

Examples

List files of an Object Storage bucket

$> oci os object list -bn datapump-storage-123456-5432
{
  "data": [
    {
      "archival-state": null,
      "etag": "9153d4d1-6208-4a25-87fe-2d14a7368e75",
      "md5": "H8scWcchoH1XrSuTgTTehA==",
      "name": "expdp.par",
      "size": 193,
      "storage-tier": "Standard",
      "time-created": "2021-02-18T13:09:02.178000+00:00",
      "time-modified": "2021-03-05T15:03:21.412000+00:00"
    }
  ],
  "prefixes": []
}

Upload a file to an Object Storage bucket

$> oci os object put -bn datapump-storage-123456-5432 --file expdp.par
Uploading object  [####################################]  100%
{
  "etag": "9153d4d1-6208-4a25-87fe-2d14a7368e75",
  "last-modified": "Thu, 18 Feb 2021 13:12:40 GMT",
  "opc-content-md5": "H8scWcchoH1XrSuTgTTehA=="
}

References

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *