Oracle Cloud Infrastructure Cloud Shell - Here's what I discovered

This week I spotted a new terminal-like icon at the top of my OCI tenancy. Upload clicking it, its a GCP-esque terminal emulator directly in the browser. I was doing some tweets about my discoveries, but thought I'd be a good idea to collate those in once place in a more consumable place.

So, first I would say, it's possible you may not have it yet in your environment. At least for me, in my personal account, I do have it appearing. This was with a home region of Sydney.

Once you launch the shell, type help and you will see a link to the official documentation. You can find it here: https://docs.cloud.oracle.com/en-us//iaas/Content/API/Concepts/cloudshellintro.htm

Like in GCP, you get 5gb of storage. This will persist for at least 8 months. You get 6 months before OCI will email your tenant administrator and another 60 days after that before your data will be purged. So, a decent enough amount of time I would think.

You can verify this with the command: df -h.
On a fresh connection, I seem to have about 100MB used. Nothing to frown at.

In my fresh shell, the .bash_history file was not present. This meant your history wouldn't persist between sessions. Easy fix, just touch that file and then your history will persist between sessions.

In /home, there are two accounts:

1. Your own
2. oci

The OCI CLI client is installed to the oci user directory.
It is using a profile with whatever access you have in OCI that you are connecting from. The region is the one to which you connect from, although, you can easily switch to another region without connecting to a new shell after switching regions in the console. Just run the command:

export OCI_CLI_REGION=eu-zurich-1 # or whichever region you want

One change I'd suggest is something like the following into your `bashrc`.

export OCI_CLI_REGION=$OCI_CLI_PROFILE

(OCI_CLI_PROFILE is set to the region in which you are active in the console, and the bash prompt has the region hard coded into the prompt)

Then modifying your PS1 variable to reference OCI_CLI_REGION. The reason for this, is if you do modify the region variable, your bash prompt will be misleading and could lead to some confusion.

The documentation states the following are pre-installed:

  • Git
  • Java
  • Python (2 and 3)
  • SQL Plus
  • kubectl
  • helm
  • maven
  • gradle
  • terraform

Some useful information in relation to pre-installed software.

Git is version 1.8. That's not so old, released back in November, 2019. Just worth noting in case them are some recent feature set you're expecting. Current stable version is 2.25

Java version is 1.8

Python2 includes the oci SDK. Python3 does not.
If you try to install new packages, you will run into issues, so the best thing to do is create a virtual environment in your home directory and use that instead. Most especially if you wish to target python3, which you should be.
You can follow these steps:

cd $HOME
mkdir python3
python3 -m venv python3/
cd python3
bin/pip3 install oci



I would suggest then updating your path to point to this new $HOME/python3/bin folder so that then becomes the default python3 that your system uses.

SQL*Plus is the latest current release - 19.5.
SQLcl is omitted from the list. According to their social media account, this is something they're working to include - so keep your eyes out for that one!

Not mentioned, Golang is also installed. It is on version 1.13. Perfect!

Also not mentioned, Docker. It is also installed and is currently at 19.03

Minor software not mentioned, jq. This is a very useful tool for working with JSON on the command line. So goes hand-in-hand with the cli client.

There seemed be sufficient about of memory for any tasks:

              total        used        free      shared  buff/cache   available
Mem:           7.5G        650M        5.5G         16M        1.4G        6.6G
Swap:          8.0G          0B        8.0G


The documentation does mentions it times out after 20min of inactivity. This seems to be slightly flaky in my experience. Even though I've been executing commands, I've noticed I would still get disconnected.

Well, so far as looking pretty nice. Kudos Oracle!

Popular posts from this blog

Installing Oracle Instant Client on Ubuntu

Report row buttons firing a dynamic action

Customising APEX built-in validation messages