How to get VSCode Cloud IDE on GCP(Google Cloud Platform)
This section describes how to launch and connect to VSCode Cloud IDE in a Google Compute environment using the available Cloud Launcher
- Open VSCode Cloud IDE listing on GCP Marketplace
- Click Launch.
- Select a zone where you want to launch the VM(such as us-east1-)
- Optionally change the number of cores and amount of memory. ( This defaults to 1 vCPUs and 3.75 GB ram)
- Optionally change the boot disk type and size. (This defaults to 'Standard Persistent Disk' and 10 GB respectively)
- Optionally change the network name and subnetwork names.
Be sure that whichever network you specify has ports 22 (for ssh), 3389 (for RDP) and 443 (for HTTPS) exposed.
- Click Deploy when you are done.
VSCode Cloud IDE will begin deploying.
- A summary page displays when the compute engine is successfully deployed. Click on the Instance link to go to the instance page .
- On the instance page, click on the "SSH" button, select "Open in browser window".
- This will open SSH window in a browser.
- Run below command to set the password for "ubuntu" user
sudo passwd ubuntu
- Now the password for ubuntu user is set, you can connect to the VM's desktop environment from any local windows machine using RDP protocol.
- To connect using RDP via Windows machine, first note the external IP of the VM from VM details page as highlighted below
- Then From your local windows machine, goto "start" menu , in the search box type and select "Remote desktop connection"
- In the "Remote Desktop connection" wizard, paste the external ip and click connect
- This will connect you to the VM's desktop environment. Provide "ubuntu" as the userid and the password set in step 6 to authenticate. Click OK
- Now you are connected to the out of box VSCode Cloud IDE environment.
- For connecting via Web Interface, SSH to the VM as shown in Step 4 and run below command-
Note down auto-generated password.
Note: If the password is empty in the file, wait for 2 minutes and check again.
- Once the vm is up and running, you can access Visual Studio Code by going to https://VM_Public_IP
Make sure you type https and not http.
- You will see certificate warning, accept the warning to proceed for login
- Use above auto-generated password from Step 13
Note: If you happen to see a blank screen in the browser after login or page load error, wait for 1-2 minutes and open again in new browser window to see VSCode load.
- We recommend to reserve the VSCode public ip address and make it static in order to access VSCode in browser over the same IP after VM restart.
Below are the steps for reserving public IP and making it static:
Having static IP will also allow the browser to save VSCode password across sessions and user will not have to enter password each time VSCode is opened in browser.
- Once the vm is up and running, go to VM instance details page and click on Edit option.
- Scroll down to Network Interfaces and edit nic0.
- From External IP dropdown select Create IP address
- Give Name and Description and click on Reserve
- Click on Save at the bottom of the page.
- Now Static IP is assigned to the VM.