Using the OCI Classic CLI utilities from OCI Cloud Shell
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 for managing IaaS and PaaS services
opc
cli for OCI Classic Compute, Storage, and Networkingftmcli
for OCI Classic Object Storagepsm
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.
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
Download the PaaS Service Manager (PSM) Command Line Interface (CLI)
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