Installing OCI CLI on Mac OS

Command Line Interface (CLI) provides the same core functionality as the console, plus additional commands, like the ability to run scripts which extends the console functionality.

To install CLI, you must have

  • OCI cloud account
  • User in a group with the right permissions
  • A key pair used for signing API requests- public key uploaded at Oracle cloud

To install the CLI on Mac OS with HomeBrew:

brew update && brew install oci-cli

To verify the OCI CLI installation

oci --version

To set up the configuration File- there are two ways to do it;

a) Use the set up config Dialog

oci setup config

this command prompts with the information required to create the configuration file and API keys. After the set up, you should upload the public api key on your the API keys section of your profile on OCI.

b) Manual set up

Log into your Oracle cloud, go to your profile, -> API keys & add an API key

Add an API Key in PEM format or generate an API key pair

Download the private key & save config file details – You will use them to set up the config file.

On your MAC OS, navigate to the .oci folder.

cd ~/.oci

if you don’t have the .oci folder, make the directory

mkdir ~/.oci 

Paste the private key downloaded from OCI on this folder and edit the permissions to ensure that only you can read the private key file:

 chmod go-rwx ~/.oci/<oci_api_key_name.pem  

Create a config file and paste the config file details from OCI.

vi config

The config file content looks similar to this- add yours,

[DEFAULT]
user=ocid1.user.oc1..<unique_ID>
fingerprint=<your_fingerprint>
key_file=~/.oci/oci_api_key.pem
tenancy=ocid1.tenancy.oc1..<unique_ID>
region=uk-london-1

(To exit vi, press escape, :wq!)

All done! Test if the OCI CLI is correctly installed and working;

oci os ns get

You should be able to read, create, update, delete the OCI resources. The output from the above command should be the Tenancy name of your OCI cloud.

{
  "data": "<tenancyname>"
}

To create an OCI object storage bucket using OCI CLI example

oci os bucket create --compartment-id <Compartment OCID> --name TestCLI

Add a file on Object Storage using the pipe command

echo "Hello World" | oci os object put --bucket-name my-bucket --name file.txt --file - 

Delete Objects in a bucket (Use –dry-run at the end if you want to first preview)

oci os object bulk-delete --namespace-name <object_storage_namespace> --bucket-name <bucket_name> 

Other useful cmds;

To upgrade your CLI install on Mac OS using Homebrew:

brew update && brew upgrade oci-cli

To uninstall the CLI on Mac OS using Homebrew:

brew uninstall oci-cli

Creating OCI CLI profile

oci setup config --profile myprofile

To use the profile, specify the name on the –profile section

oci os ns get --profile myprofile

To generate new public and private keys on the .oci folder

openssl rsa -pubout -in ~/.oci/oci_api_key.pem -out ~/.oci/oci_api_key_public.pem

References

Oracle Cloud Documentation

A multi cloud strategy in cloud adoption

Cloud computing is the convenient model of computing where users can access from anywhere a shared pool of resources and pay only for what they consume.

It has been largely adopted by majority of the startups , SMEs (Small and Medium-sized Enterprises), and large enterprise businesses. Among the reasons being that it makes the businesses to focus on the core of their business as the cloud provider offers a scalable, reliable and on demand infrastructure, platform or software service.

Multi cloud strategy is the newly adopted trend where businesses are involving more than one cloud vendor to support their business. This should not be confused with hybrid computing.

Hybrid computing refers to when a business runs some of it’s workloads on premise and other on a public or private cloud with a secured connection between the two. Multi cloud on the other hand refers to when a business involves different cloud providers to run it’s workloads.

Some of the benefits of a Multi Cloud Strategy include:

  • Avoiding Vendor lock in – Some enterprises are afraid of being locked into a single vendor- thus with the multi cloud strategy they are not “dependent” on a single cloud provider.
  • Redundancy and Performance – Every enterprise wants to have a continual up time and performance to beat their competition. This makes them approach multi cloud strategy to support their strategy.
  • Data sovereignty /Compliance – Due to different regulations, some enterprises are forced to adopt certain cloud vendors within their regions or within the stipulated regulations regarding data .

However, a multi cloud strategy comes at cost such as you require a large talent pool to handle the various technologies from the various vendors, this can also lead to management complexity.

Some cloud vendors have already adopted the multi cloud model.

Oracle Cloud and Microsoft Azure cloud have a interoperability partnership allowing customers to run mission critical enterprise workloads across both clouds.

Google embraces the mult cloud strategy with Anthos, an open application modernization platform.

As an enterprise, you need to evaluate your current status on the digital transformation journey, where you are today and where you target to be, then choose wisely a cloud strategy that shall offer you a high ROI.

Laban.

Today, the greatest concern on many enterprise IT infrastructures is manageability, reliability , availability, performance, security, scalability just to list a few.

If a multi cloud strategy solves the above challenges for you, then it’s time you take the leap.

References:

Tech Target

ZD Net

Oracle News

Google News

Bash commands you can never live without!

This is more of a generic post. I am posting some of the Bash/Linux/Windows commands i find useful everyday!

Source Control :Git

When you want to push your local project to GitHub, create a repository (Don’t add a Readme file yet) on GitHub.

On your local workstation, fire the bash utility in the root folder of your project on your windows file system.

On the Git Bash, run:

git init
git remote add origin https:// (link to your online repository)
git remote -v (Just to confirm your remote repo)
echo 'node_modules'>>.gitignore (Files you want to ignore to pushing to GitHub)
git add .
git commit -m "First commit"
git push origin master

A times you may have commit issues due to file conflicts:

Open the conflicting file -edit and merge the head accordingly. Then;

git add filename
git commit -m "merged file A and B"git push origin master

Other commands:

Ngrok: (helps you expose your localhost to public internet)

http localhost:<port>  (Windows, where port is your port number)

./ngrok http <port> (Linux, where port is your port number)

In Oracle compute, you might want to run a “screen” command to run the ngrok  on detached mode:

screen-S <name of the new screen> This opens a new Screen.

Deploy ngrok on this screen. When done press Ctrl +A+ D to exit.

To confirm the the screen got created:

screen -ls  (shows you all the screens and their ids named "Detached")

To re-access the screen:

screen -r <screen_ID>

To quit:

screen -X -S <screen_id> quit

What other commands do you use daily… but you keep forgetting?

Happy coding! Keep Innovating!