Configure Oracle OCI Command Line Interface (CLI) in Windows

You can run command from Windows prompt to complete OCI infrastructure tasks like list or create buckets, create instances and many more things. You get control of your OCI console via command based on security rule assigned to your user.

Follow Oracle document link for more detail. Below setup talks about the steps required for Windows machine.

Open the PowerShell console using the Run as Administrator option and run below command.

Set-ExecutionPolicy RemoteSigned

Now download installer script.

Invoke-WebRequest -OutFile install.ps1

Run the installer script. This will also download and install any dependencies like Python.

iex ((New-Object System.Net.WebClient).DownloadString(''))

Once OCI CLI is installed, it can be checked using below command.

oci --version

Last step is to configure OCI cli with your Cloud user account. For this, you need to download API Key of the OCI user. Login to oracle Cloud and click right side on Profile link.

Click on User link and then API Keys.

Click Add API Key to create new Private/Public Key and download for further reference.

You will also need some other information during OCI CLI set up for your OCI account like

  • Tenancy
  • OCID
  • Region

You can get above information by clicking on View Configuration File on previous User detail screen.

So the OCI User key and other dependent information is ready to configure OCI CLI on Windows. Run below command to start configuration. It will prompt to provide OCI cloud information

oci setup config

Once the above installation completes, you are ready to use OCI cloud services from Windows Command. For example, lets run command to find list of bucket in my OCI account. Get the OCID of the compartment and pass the value in below command.

oci os bucket list -c ocid1.compartment.oc1..aaaaaaaa

Hurray!! You can now use OCI CLI commands in Windows.