14_Cloud_Shell_Basics - Nirvan-Pandey/OCI_DOC GitHub Wiki
Basics of Cloud shell Feature
14_1: Using Cloud Shell in Oracle Cloud Infrastructure (OCI)
This document provides an overview of how to use the Cloud Shell feature in Oracle Cloud Infrastructure (OCI) and demonstrates some basic commands to get us started. Cloud Shell is a web-based terminal accessible directly from the OCI Console, providing a pre-configured environment with necessary tools for managing your OCI resources.
Overview Cloud Shell is a convenient and secure way to manage our OCI resources without needing to set up a local development environment. It includes a variety of tools and utilities pre-installed, such as the OCI CLI, Git, and Kubernetes tools.
14_2: Accessing Cloud Shell
Step1: Log in to the OCI Console: Open your web browser and log in to the [OCI Console].
Step2: Open Cloud Shell: Click on the Cloud Shell icon located in the top-right corner of the OCI Console. The icon looks like a terminal window.
Step3: Initialize Cloud Shell The Cloud Shell terminal will open at the bottom of the OCI Console. It may take a few moments to initialize.
You can maximize the window by clicking the maximize sign.
14_3: Running Basic Commands
Once Cloud Shell is initialized, we can run various commands to manage your OCI resources. Here are some basic commands to get us started:
- Check OCI CLI Version:
oci --version
- List All Compartments:
oci iam compartment list --all
- Get Details of a Specific Instance:
oci compute instance get --instance-id <instance-ocid>
oci compute instance get --instance-id ocid1.instance.oc1.ap-mumbai-1.anrg6ljrugo2acacb5khczo4cuk72mkktltrftzxubgzuxh6gmtblh6jl6xa
- List All Compute Instances in a Compartment:
oci compute instance list --compartment-id <compartment-ocid>
oci compute instance list --compartment-id ocid1.compartment.oc1..aaaaaaaaj7cezlvk6iaqiksvy3w4mdwvyo4nvn4q3gyrctgru64vles3hdta
- Check disk usuage.
df -h
- Lists information about all available or specified block devices.
lsblk
14_4: Private Network Definition List
In an organization where access to the public network is restricted, we need to create a private network definition list. Follow these steps to create it:
Step 1: Access Network in Cloud Shell Open your Cloud Shell. Click on the Network option.
Step 2: Choose Private Network Definition List In the Network section, select Private Network Definition List.
Step 3: Configure Parameters and Create.
Choose the necessary parameters for your private network. Ensure to select the existing VPN and the compartment where you want to access the network. You can choose any name for the network definition list.
Step4: Click Create to finalize the setup.
By following these steps, you will successfully create a private network definition list in your Cloud Shell environment.
14_5: Downloading files form cloudshell.
Step1: Create a sample file.
touch new.txt
Step2: Check the list.
ls -lrth
Step3: Redirect statement into the file.
echo 'This is test' >> new.txt
Step4: Reverify the content by reading,
cat new.txt
Step5: Download the file.
We can download the file by click on settings icon on the upper right hand of editor.
Enter the file name and download it.
Note: Please note that the files can be downloaded from home directory only. If the intended download file is not at the home directory, please mention the path of the file.