Oracle announces “The Oracle Public Cloud Command-Line Interface”

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.7Python 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:

/Compute-identity_domain/user

For example, if your identity domain is usoracle52237 and the username in your account-creation email is prasenjit.sarkar@oracle.com, then the following would be the two-part user name that you must use for REST API calls:

/Compute-usoracle52237/prasenjit.sarkar@oracle.com

  • Download the zip file from OTN

OPC Download

  • Unzip the CLI installation bundle.
  • Install the RPM file. To ensure that all the dependencies are satisfied, use yum.
  • Store the REST API endpoint URL of your Oracle Compute Cloud Service site in an environment variable named OPC_API (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 OPC_USER.
    • export OPC_USER=/Compute-usoracle52237/prasenjit.sarkar@oracle.com

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

Launchplan

Example of my launchplan.json is as follows. You can download it from here.

launchplan-json

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.

 

About Prasenjit Sarkar

Prasenjit Sarkar is a Product Manager at Oracle for their Public Cloud with primary focus on Cloud Strategy, Oracle Openstack, PaaS, Cloud Native Applications and API Platform. His primary focus is driving Oracle’s Cloud Computing business with commercial and public sector customers; helping to shape and deliver on a strategy to build broad use of Oracle’s Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) offerings such as Compute, Storage, Java as a Service, and Database as a Service. He is also responsible for developing public/private cloud integration strategies, customer’s Cloud Computing architecture vision, future state architectures, and implementable architecture roadmaps in the context of the public, private, and hybrid cloud computing solutions Oracle can offer.