Oracle Analytics Cloud (OAC) provides a complete enterprise-level analytics environment that encompasses all of an organization’s requirements including self-service data ingestion and visualization, curated data models that can access on-premise data warehouses via Remote Data Gateway, augmented analytics through built-in machine learning functions, and natural language insights into data.
OAC provides administrators browser based tools to provision and manage OAC instances. In addition, Oracle provides a tool called PaaS Service Manager (PSM) that offers command-line (CLI) level access to a variety of Oracle Cloud services to manage the full lifecycle of cloud instances. The CLI is a program that serves as a wrapper over Oracle PaaS REST APIs. From a command line, a number of functions are available to invoke the APIs to execute various tasks. This provides an easy way to script activities or run them from a scheduler. PSM supports a number of Oracle platform offerings, however, this blog post will focus solely on using it with Oracle Analytics Cloud.
One possible use case for PSM with OAC would be where a customer has purchased Universal Credits to pay for their OAC instances. In a typical configuration, there would be at least two instances: DEV and PROD. It is now possible with OAC to “stop” an instance – more accurately “suspend” it as it will be inaccessible to users but still be able to be restarted quickly. While the instance is in a stopped state, the amount of Universal Credits used per hour is reduced to approximately 15% of the cost of a running instance. So, in a typical case where the DEV environment is not used on weekends, it is possible to save credits by stopping the DEV instance on Friday evening and restarting it on Monday morning. This can be done manually from the Oracle Cloud dashboard. However, with PSM, it would be possible to script and schedule that same stop/start activity to have it executed each week automatically.
Using PSM with OAC requires the following steps:
Performing prerequisite tasks for the Command Line Interface
Downloading the Command Line Interface
Installing the Command Line Interface
Configuring the Command Line Interface
Use the Command Line Interface with OAC
Step One: Performing prerequisite tasks for the Command Line Interface
Below are the prerequisite steps for installing cURL and Python, if necessary.
cURL is an open source, command-line tool for transferring data with URL syntax, and supporting various protocols including HTTP and HTTPs.
In your browser, navigate to the cURL home page at http://curl.haxx.se and click “Download” in the navigation menu.
On the cURL Releases and Downloads page, locate the SSL-enabled version of the cURL software that corresponds to your operating system, click the link to download the ZIP file, and extract the executable to the desired folder.
If you are running Windows, follow these steps to install Python 3.3 or later:
Launch a Windows command prompt.
Determine the version of Python you currently have installed on your machine using the command: “python –version”
If your current version is below 3.3, then download and install the Python Windows installation executable from python.org
Step Two: Downloading the Command Line Interface
To install PSM, a zip file is downloaded from Oracle Cloud and then installed from the command line using the following steps:
On Oracle Cloud Console, look at the top right, click the profile icon and select “Service User Console”.
On the Cloud My Home page, select your service.
Click the user icon in the top right corner to open the context menu.
Select Help and then select “Download Center”.
Figure 1 – A screenshot that illustrates how to get to the Download Center in OAC
The Download Center dialog appears. The CLI option is indicated by the CLI icon (CLI icon).
5. Click the download button next to the CLI description text
Figure 2 – A screenshot that illustrates the Download Center dialog
Step Three: Installing the Command Line Interface
The psmcli.zip file downloads to your machine and is ready for installation. Install the PaaS CLI as a Python package. Use the PIP tool pip3 to install the CLI Python package.
On Windows, from the command line: “pip3 install -U psmcli.zip”
You will now be able to execute PSM commands from the command line.
Step Four: Configuring the Command Line Interface
The first step in using PSM is to set up the configuration details to connect to a particular Oracle Cloud environment. At a minimum, an Oracle Cloud username, password, and identity domain will be required. Use the psm setup command to do this: