Use Visual Studio Code with Q Blocks instances

Setup time less than 5 minutes

Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications.

It is commonly referred to as VS Code and is a source-code editor made by Microsoft for Windows, Linux and macOS.

Q Blocks instances can be easily accessed through VSCode to support coding and development setup for your teams.

Pre-requisites:

  • Enable TCP Forwarding in Q Blocks instance sshd_config

  • Set Host Information in local system’s SSH config

1. Enable TCP Forwarding in Q Blocks instance sshd_config:

Visual Studio Code needs TCP Forwarding to work properly.

TCP forwarding is by default disabled in Q Blocks instance sshd configuration file for security reasons.

To change this setting, run the following commands as qblocks user in your Q Blocks instance:

sudo sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/g' /etc/ssh/sshd_config
sudo systemctl restart sshd

This will Allow TCP forwarding and then restart the SSH Daemon.

2. Set Host Information in local system’s SSH config:

SSH config file contains the information of the remote hosts that you want to access from your local computer.

VScode saves these remote hosts in the “REMORE EXPLORER” tab, so you don’t have to re-enter the ssh information next time and thus access the remote host from the VSCode on your local system easily.

Simply add the following the information in your ssh config file present at: ~/.ssh/config location

Host qblocks-instance
  HostName HOST_URL
  IdentityFile /PATH/TO/KEYFILE
  User USER
  Port SSH_PORT

Information such as SSH_PORT, HOST_URL, USER can be easily obtained by clicking on “Connect” option on your instance and then selecting the SSH information.

As seen in the example image below:

  • HOST_URL = jeu.qblocks.cloud

  • SSH_PORT = 57231

  • USER = qblocks (or any new user that you created)

Please note: This is an example. The information will be different for your instance.

Please ensure the ssh key has 600 permissions set.

🚀 Once configured, you can simply go to your Visual studio application and then select the qblocks-instance ssh target under the “REMORE EXPLORER” tab and try connecting to it.

Please reach out to us at support@qblocks.cloud if you face any difficulty.

Last updated