๐Ÿš How to Use Oracle Cloud Shell Like a Pro



Introduction

Oracle Cloud Shell is a browser-based terminal pre-authenticated with your Oracle Cloud account. It comes with a rich set of tools to help you manage and automate your OCI resources—no setup needed.

In this blog, we’ll walk through everything from launching Cloud Shell to using advanced tools like oci-cli, Git, and Terraform—all directly from your browser.

๐Ÿงฐ What Is Oracle Cloud Shell?

  • Web-based shell environment

  • Persistent 5GB storage in $HOME/cloudshell

  • Pre-installed tools:

    • OCI CLI

    • Git

    • Terraform

    • Kubectl

    • Helm

    • Python, Java, Node.js

    • Text editors (nano, vi)

  • Auto-authenticated: No need to configure your API keys.

๐ŸŸข How to Launch Oracle Cloud Shell

  1. Log in to Oracle Cloud Console.

  2. Click the Cloud Shell icon (top-right corner, looks like >_).

  3. The shell will open in the lower panel—ready to use.

⚙️ Exploring the Environment

Code :
# Check current user
whoami

# List home directory contents
ls -la

# Check available tools
which oci
which terraform
which git

Check OCI CLI Version

oci --version




๐Ÿ“ Persistent Storage in Cloud Shell

You get 5GB persistent storage in $HOME/cloudshell. Use it to store:

  • Scripts

  • Terraform files

  • Git repos

  • Configs

cd ~/cloudshell
mkdir my_project

⚠️ Files stored outside ~/cloudshell are NOT persistent across sessions.

☁️ Managing OCI Resources Using OCI CLI

OCI CLI is pre-installed and authenticated. Example commands:

List all Compartments:

oci iam compartment list --all

Create a Compute Instance:

oci compute instance launch \
--availability-domain "Your-AD" \
--compartment-id "ocid1.compartment.oc1..." \
--shape "VM.Standard.E4.Flex" \
--image-id "ocid1.image.oc1..." \
--subnet-id "ocid1.subnet.oc1..." \
--assign-public-ip true

๐Ÿ’ก Use oci compute image list to find available images.

๐Ÿงช Run Terraform in Cloud Shell



1. Create Terraform files

cd ~/cloudshell
mkdir terraform_vm && cd terraform_vm
vi main.tf

2. Initialize and Apply

terraform init
terraform plan
terraform apply

๐Ÿ” Authentication is already handled — no need to set up .oci/config.

๐Ÿงฌ Using Git in Cloud Shell

Git is pre-installed and can be used to clone or push repos.

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

git clone https://github.com/your-repo/project.git

Push changes:
git add .
git commit -m "Initial commit"
git push origin main

๐Ÿณ Advanced Tools: kubectl, Helm, Docker

Cloud Shell supports container tools:

Use kubectl with OKE:

oci ce cluster create-kubeconfig \
--cluster-id ocid1.cluster.oc1... \
--file $HOME/.kube/config \
--region us-ashburn-1 \
--token-version 2.0.0

kubectl get nodes

๐Ÿ›‘ Limitations of Cloud Shell

  • 5GB persistent storage only

  • Session timeout after inactivity

  • Not ideal for long-running tasks

  • No root access

๐Ÿ“ Final Thoughts

Oracle Cloud Shell is a powerful tool that removes the need to install and configure CLI tools on your local machine. Whether you're testing, automating, or managing resources—Cloud Shell lets you do it all with minimal effort.

Use it wisely and pair it with automation via Terraform or OCI CLI scripts to supercharge your productivity in the cloud


๐Ÿ“Ž Related Resources

https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cliconcepts.htm

https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cloudshellintro.htm



Comments

Popular posts from this blog

Setting Up Monitoring and Alerts in OCI for Your Resources

Introduction to Oracle Vector Search – Concepts, Requirements & Use Cases