Using the OCI Classic CLI utilities from OCI Cloud Shell

Stephen Cross
Jun 2 · 4 min read

The OCI Cloud Shell is an excellent way of quickly using the OCI CLI and other tools for managing you OCI environment from the command line, but what if you’re still using the OCI Classic services?

If you’re running in an environment with access to both OCI and OCI Classic Services, or maybe you’re in the process of moving from OCI Classic to OCI then the following tips will help you run the OCI Classic command line utilities from with the OCI Cloud Shell

  • opc cli for OCI Classic Compute, Storage, and Networking
  • ftmcli for OCI Classic Object Storage
  • psm cli for OCI Classic Platform Services, DBCS, JCS, SOACS etc.

opc command line utility

The opc command line utility is used to manage the OCI Classic Compute Service resources. The opc cli can manage the lifecycle of the OCI Classic compute instances, networking, block storage, and orchestrations.

Download the opc cli to your local machine https://www.oracle.com/downloads/cloud/opc-cli-downloads.html. e.g. opc-cli-18.1.2.zip

Open Cloud Shell in the OCI Console and select the Upload option from the menu and upload the opc cli zip file.

OCLI Cloud Shell Upload
Upload opc-cli-18.1.2.zip

In the Cloud Shell terminal extract the uploaded zip to get the opc command line executable.

$ unzip opc-cli-18.1.2.zip linux/opc

The opc command can now be run in the Cloud Shell from the linux directory.

$ ./linux/opc --help

To use the opc cli with your OCI Classic environment you need to create the required profile configuration files.

$ mkdir -p ~/.opc/profiles
$ touch ~/.opc/password
$ chmod 600 ~/.opc/password

Create the file ~/.opc/profiles/default, setting the appropriate Compute Service ID, User name, and Compute Classic REST endpoint details.

{
"compute": {
"user": "/Compute-a123456/user@example.com",
"endpoint": "compute.uscom-east-1.oraclecloud.com",
"password-file": "~/.opc/password"
}
}

Update the ~/.opc/password file with your account password.

You can now run the opc cli against your Classic environment, e.g. to list all compute instances.

$ ./linux/opc -F state,name compute instance list /Compute-a123456
running /Compute-a123456/user@example.com/AppServer/977d8f95-d33e-4a28-a073-e44161d7f6ed

For more details on using the opc cli refer to the CLI Reference for Oracle Cloud Infrastructure Compute Classic

ftmcli command line utility

The ftmcli command line utility is used to manage the OCI Classic Object Storage containers and objects

Download the ftmcli to your local machine from https://www.oracle.com/downloads/cloud/storage-cloud-upload-cli-downloads.html

Open Cloud Shell in the OCI Console and select the Upload option from the menu and upload the ftmcli zip file.

In the Cloud Shell terminal extract the ftmcli.jar file from the uploaded zip, e.g.

$ unzip ftmcli-v2.4.3.zip ftmcli-v2.4.3/ftmcli.jar

You can now run the ftmcli utility using the java command already pre-installed in Cloud Shell.

$ java -jar ./ftmcli-v2.4.3/ftmcli.jar --help

To use ftmcli to list the OCI Classic Object Storage containers set the username and storage rest endpoint in the command options, e.g.

$ java -jar ftmcli.jar list \
--user user@example.com \
--rest-endpoint https://uscom-central-1.storage.oraclecloud.com/v1/Storage-a123456

Enter your password: ********

For more details on using the ftmcli refer to the Command-Line Reference for Oracle Cloud Infrastructure Object Storage Classic

psm command line utility

The psm command line utility can be used the manage the lifecycle of several Platform service in OCI and OCI Classic, including Database Classic (DBCS) Java Cloud Service (JCS) and SOA Cloud Service (SOACS).

Download the psm utility from the Platform Service Console. From the User Profile icon select Help > Download Center

OCI Classic Platform Service Console > Profile > Help > Download Center

Download the PaaS Service Manager (PSM) Command Line Interface (CLI)

PaaS Service Manager (PSM) Command Line Interface (CLI) Download

Open Cloud Shell in the OCI Console and select the Upload option from the menu and upload the psmcli.zip file.

In the Cloud Shell terminal install the psm utility as python package for the local user.

$ pip3 install --user ./psmcli.zip

You can now run the psm utility in Cloud Shell from the .local/bin directory

$ .local/bin/psm --help

Run the setup command to configure the psm cli to connect with the OCI Classic services. Note the Identity domain is the tenancy name for Traditional accounts, or the idcs ID for Cloud Accounts.

$ .local/bin/psm setup
Username: user@example.com
Password: ********
Retype Password: ********
Identity domain: a123456
Region [us]:
Output format [short]:
Use OAuth? [n]:

Use the psm cli to manage your Classic Platform Services, e.g. to list all Database Classic services.

$ .local/bin/psm DBCS services

For more details on using the psm cli refer to the PaaS Service Manager Command Line Interface Reference

Oracle Developers

A community for developers by developers.

Oracle Developers

Aggregation of articles from Oracle engineers, Groundbreaker Ambassadors, Oracle ACEs, and Java Champions on all things Oracle technology. The views expressed are those of the authors and not necessarily of Oracle.

Stephen Cross

Written by

Product Manager, Oracle Cloud Infrastructure

Oracle Developers

Aggregation of articles from Oracle engineers, Groundbreaker Ambassadors, Oracle ACEs, and Java Champions on all things Oracle technology. The views expressed are those of the authors and not necessarily of Oracle.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store