Posts

Showing posts from February, 2020

Iterating OCI CLI list data in bash

Image
For automating tasks with OCI, you have a few options: OCI CLI (bash) Python SDK Go SDK Java SDK REST API I'm a bash first kinda guy, so would usually opt for trying with the bash solution if the requirement is simple enough. Anything beyond, it's worth moving over to Python or GO. When you run a command, you will typically get a JSON payload. But I'm in bash, how to I interact with this data? That's where this nice tool jq comes in. An interface to JSON data, where you can pass in a json path to get the data you want. When you get started with this you will want to leverage the website jqplay.org . It provides a visual interface to the query paths you build, along with some common examples. So, now over to iterating the data structure. I'm going to take the compartment list as an example. When calling the command: oci iam compartment list, the data set in my tenancy looks like this: { "data": [ { "compartment-id":

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

Image
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 fre