There are cases your computer is not satisfying for your development. Sometimes to have a fresh start, sometimes to run on Linux from Windows without a VM, sometimes to be close to the target execution environment.
As a developer, you can use Oracle Cloud Infrastructure (OCI) as your development environment. Dynamic Groups and cloning your disk to speedup onboarding of other developers via using Custom Images. Many other scenarios are possible. I will be using latest Ubuntu Image. You can select any number of images that will suit to your need. There are also other Oracle images available such as Oracle Cloud Developer Image and Visual Studio Code Remote Workstation.
Let us begin with setting up this development environment and connect your favorite Integrated Development Environment (IDE) tools such as Eclipse or Visual Studio Code (VScode) using remote ssh. Theia is a web-based IDE very similar to VScode. If you do not like installing VScode on your local, you can setup remote connection to Theia on OCI.
If you are in a workshop and following this guide. Follow the instructions of your instructor, there might be some steps already created for you.
Following steps are covered in this blog:
If you have created your SSH keys, you might skip this step
Creating SSH Keys for Use with Oracle Cloud Services explains how to create keys in detail. I would recommend the following steps:
Compartments are good to isolate resources in the OCI. Using a separate compartment for development purpose will be the best approach here. Let us name this compartment as develop. You can have this on your root, as a generic purpose or place within projects or departments compartment.
While creating network and compute instances you need to select this development compartment.
You might use the same network for all this development purpose compute instances. For creating the network, using Virtual Networking Quickstart is good place to start with. You can select VCN with Internet Connectivity option, unless you do not have an IPSec VPN scenario.
Make sure that you are creating in correct compartment.
You might name this VCN as development too.
Creating Compute instance is a straightforward task. Here the most preferable choices for development environment are shown.
If you already have public keys (generating is explained earlier), you may select those keys. If you do not prefer to provide, system can generate that for you. Download and keep safe both private and public keys.
Create and your compute instance will be up and running soon. Public IP address of the machine will be displayed when the instance is ready.
Download and install VScode. If you are using a Linux computer, some of the Linux distribution marketplaces contains VScode for faster start.
In order to access to a remote workspace over SSH, Remote SSH extension is required. How to use that tool is explained in the extension page (That green area on bottom left of VScode)
VScode has built-in terminal support. If the (target) machine has more than one option, you will be asked to select that kind of terminal. For example, on your local Windows machine with Git-Bash installed it will ask you “Command Prompt”, “Power Shell” or “Git-Bash”. In my case, that remote machine Ubuntu has bash as default terminal and this will not be asked.
On the top menu, select Terminal > New Terminal to create new one. The keyboard shortcut might be different to you.
VScode installs a small program on the remote machine. This in communication with your local VScode instance. This program is called code same as on your local machine. It does open the files within VScode or navigates the explorer to that folder. You can try an example:
Using code is advised instead of other terminal based editors, such as vi or nano. In a documentation, while using VScode remote terminal replace the command with code.
This code command will not work if you are on a different user, such as root. In that case, continue to use traditional terminal editors as instructed.
Built-in VScode explorer can be used explore files and folders on the remote machine.
You can download (remote files & folder) and upload (local files & folders) easily with simple UI operations.
In order to download a file or folder, select that on Explorer and right-click. In the opened context menu, select download
You will be asked where to save.
In order to upload local files, simply drag & drop to the explorer. While dragging make sure that you are hovering on correct folder