Yes Oracle announced their much awaited OPC CLI utility. The Oracle Public Cloud Command-Line Interface is a utility to enable management of your cloud environment from the command line. The current release supports the Compute Service, with additional service support coming in future releases. You can download it here for your supported platform.
Oracle Compute Cloud Service provides a comprehensive set of
oracle-compute CLI commands that you can use to view and manage instances, manage storage and networking, and manage SSH keys. You can read the documentation here.
So, let’s look at the very common use case where we will install the CLI, setup the environment to work with Oracle Public Cloud Compute Services and then create an instance using launchplan.
There are two requirements to get it installed, you need to have Oracle Linux 6.7 & Python 2 (2.6.6 or later). Download the zip file from the link mentioned above and put that into a directory of your choice inside the machine where you want to launch it from.
As a prerequisite, you need to collect your authentication credentials for the Compute Cloud Service.
The user name consists of two parts, in the following format:
For example, if your identity domain is
usoracle52237and the username in your account-creation email is
email@example.com, then the following would be the two-part user name that you must use for REST API calls:
- Download the zip file from OTN
- Unzip the CLI installation bundle.
- Install the RPM file. To ensure that all the dependencies are satisfied, use
- Store the REST API endpoint URL of your Oracle Compute Cloud Service site in an environment variable named
(written article on how to retrieve REST endpoint).
- export OPC_API=”https://api-z17.compute.em2.oraclecloud.com”
- Store your two-part user name (
/Compute-identity_domain/user) in an environment variable named
- export OPC_USER=/Computefirstname.lastname@example.org
At this point, you can store your password in a plan text file and point it to the file while running the command, however, I will not use that method rather provide password every time I the command.
Now let’s create an instance using launchplan. A launch plan is a JSON-formatted file that defines the properties of one or more instances. You can use a launch plan to quickly create and start multiple, non-persistent instances in Oracle Compute Cloud Service. Note that while you can reuse your launch plan JSON file to create instances afresh based on the attributes and provisioning sequence specified in the JSON file, the launch plan itself doesn’t persist in Oracle Compute Cloud Service.
- Syntax to create the instance using launchplan is as follows:
oracle-compute launch launchplan filename -f json
Example of my launchplan.json is as follows. You can download it from here.
This launch plan will create a Oracle Linux 6.4 instance of OC3 shape that includes a public IP from the pool, opens up HTTP & SSH ports and adds SSH key to login.
OPC CLI is a pretty comprehensive tool to manage the Compute Service from your own environment and still getting all the benefits.