LAB 24 ‐ OCI Cloud Shell - DevWithNehaCloud/Oracle-Cloud-Infrastructure-wiki GitHub Wiki
Objective
Learn how to use OCI Cloud Shell to run Linux commands and manage OCI resources directly from the browser.
What is OCI Cloud Shell?
OCI Cloud Shell is a browser-based terminal provided by Oracle Cloud Infrastructure.
It allows users to:
- Run Linux commands
- Use OCI CLI commands
- Access cloud resources
- Manage OCI services without installing software locally
Step 1: Login to OCI Console then click on developer tools and then click on Cloud Shell.
Now by default as you can see you are connected with public network where you can run your linux commands.
Step 2: Now change the Network public to Private network definition list.
Now click on Create private network definition.
Step 3: Now select the compartment(where you have created the VCN/Subnet) and give the name of the private network definition, select use as active network and then click on create.
As you can see now private network definition is created. click on close.
Step 4: Now again click on Private network definition list.
Now click on three dots and click on Use as active network.
again click on Use as active network and then click on close.
As you can see, now we are connected with our private network that is Sandbox-PND-01
Now, first we create a directory and inside that directory we create a file then we download this file from OCI cloud shell to our local laptop.
There is no need to specify the Absolute Path (starting from /home). You only need to provide the path relative to your current directory, such as ParentFolder/FileName. ex. my-dir/sample.txt
OCI Network Types in Cloud Shell
1. Public Network
Definition
A Public Network allows resources to communicate with the internet using public IP addresses.
When We Use It
- Accessing websites or APIs from the internet
- SSH access to instances
- Hosting public applications
Common Usage
Most commonly used for:
- Web servers
- Bastion servers
- Internet-facing applications
2. OCI Service Network
Definition
An OCI Service Network provides private access to Oracle Cloud services without using the public internet.
When We Use It
- Accessing Object Storage privately
- Connecting OCI services securely
- Avoiding internet traffic
Common Usage
Used when:
- Security is important
- Traffic should stay inside OCI network
3. Private Network Definition List
Definition
A Private Network Definition List is a saved configuration file that defines private networking settings and rules.
When We Use It
- Reusing network configurations
- Automating network setup
- Exporting/importing network settings
Common Usage
Mostly used in:
- Automation
- Infrastructure as Code
- Cloud Shell networking configurations
4. Ephemeral Private Network Setup
Definition
An Ephemeral Private Network is a temporary private network created for short-term communication and automatically removed after use.
When We Use It
- Temporary testing
- Short-lived sessions
- Secure temporary connectivity
Common Usage
Used for:
- Temporary workloads
- Testing environments
- Session-based networking
Quick Difference Table
| Network Type | Internet Access | Private Communication | Temporary/Permanent | Common Use |
|---|---|---|---|---|
| Public Network | Yes | No | Permanent | Public apps, SSH |
| OCI Service Network | No | Yes | Permanent | OCI services access |
| Private Network Definition List | No | Yes | Permanent Config | Reusable configurations |
| Ephemeral Private Network Setup | No | Yes | Temporary | Testing, short-term access |
Which One is Used Most?
| Network Type | Usage Frequency |
|---|---|
| Public Network | Most Common |
| OCI Service Network | Very Common |
| Private Network Definition List | Used in automation |
| Ephemeral Private Network Setup | Less Common |
OCI Cloud Shell vs PuTTY
Overview
Both OCI Cloud Shell and PuTTY are used to run Linux commands, but OCI Cloud Shell provides additional cloud management and automation capabilities directly from the OCI Console.
Difference Between OCI Cloud Shell and PuTTY
| OCI Cloud Shell | PuTTY |
|---|---|
| Browser-based terminal | Local SSH client |
| No installation required | Requires installation |
| OCI CLI pre-installed | OCI CLI must be installed manually |
| Directly connected with OCI Console | Manual SSH connection required |
| Accessible from anywhere | Depends on local system |
| Secure Oracle-managed environment | Depends on local machine configuration |
Professional Use of OCI Cloud Shell
1. Quick OCI Resource Management
Cloud engineers use OCI Cloud Shell to:
- Manage compute instances
- Create and manage buckets
- Check networking resources
- Run OCI CLI commands
- Troubleshoot cloud resources
without manually connecting to servers.
2. OCI CLI Already Installed
OCI Cloud Shell already contains OCI CLI.
Example:
oci --version
Benefit
No need to:
- Install OCI CLI manually
- Configure credentials locally
3. Faster Troubleshooting
Professionals use Cloud Shell for:
- Checking VCN configuration
- Verifying instance status
- Testing network connectivity
- Running scripts
- Managing cloud resources
Example:
oci compute instance list
4. No SSH Key Setup Required
In PuTTY:
- SSH keys must be created
- Keys must be configured manually
In OCI Cloud Shell:
- Login to OCI Console
- Open Cloud Shell
- Start working immediately
5. Automation and Scripting
Cloud Shell is commonly used for:
- Bash scripting
- OCI automation
- Terraform commands
- Kubernetes management
- DevOps operations
6. Secure Environment
OCI Cloud Shell provides:
- Oracle-managed secure environment
- Temporary cloud session
- No dependency on local machine setup
This improves operational security in enterprise environments.
Real Professional Scenario
Example
A production server becomes unavailable.
The cloud engineer:
- Opens OCI Console
- Launches OCI Cloud Shell
- Runs troubleshooting commands
Example:
oci compute instance list
The engineer can quickly:
- Verify instance status
- Check networking
- Validate attached volumes
- Troubleshoot issues
without configuring PuTTY or SSH manually.
Simple Understanding
| Tool | Main Purpose |
|---|---|
| PuTTY | Connect to Linux server using SSH |
| OCI Cloud Shell | Full cloud management terminal inside OCI Console |
Advantages of OCI Cloud Shell
- No software installation required
- OCI CLI already available
- Browser-based access
- Fast troubleshooting
- Useful for automation
- Secure cloud-managed environment
- Ideal for DevOps and cloud administration
Conclusion
Professional Usage
OCI Cloud Shell is Professionally Used For
- OCI administration
- Cloud automation
- Troubleshooting OCI resources
- Running OCI CLI commands
- DevOps operations
- Terraform and Kubernetes management
- Managing cloud infrastructure directly from OCI Console
It saves time because everything is preconfigured inside the OCI Console.
PuTTY is Professionally Used For
- Connecting to Linux servers using SSH
- Remote server administration
- Managing on-premises servers
- Accessing virtual machines manually
- Running Linux commands on remote systems
- Troubleshooting server-level issues
- Secure remote terminal access
4. Summary
"I use OCI Cloud Shell for Cloud Administration because it provides a secure, managed environment with pre-installed DevOps tools like Terraform and the OCI CLI. However, for Instance Management and software installation inside a VM, I prefer using PuTTY/SSH for direct access to the Operating System."