Connect to a Linux instance from Linux / macOS
Having completed the prerequisites and obtained connection information, you can use one of the following two methods to connect to the Linux instance from Linux/macOS.
Please note that you can connect to the instance only when its state is Ready
.
1. Built-in command line (Terminal)
Open terminal on your local computer, enter the commands sequentially according to obtaining connection information to change the permission of the key pair and connect to the VCS instance.
2. Third-party software: VScode
If you are already using VScode to develop your program, you may directly using it to connect to your VCS instance. VScode supports a variety of platforms and has many plug-in software packages that are easy to install and suitable for novices. For complete instructions, please refer to the Official documentation.
Step 1. Download and install VScode
Please download VScode and open the application.
Step 2. Install SSH extension
Click Extensions > search for remote ssh > select Remote- SSH and click Install.
Step 3. Create config file
- After the installation is complete, click the icon in the lower left corner of the window to open the remote connection.
- Select Remote-SSH: Open Configuration File.
- Select C:\Users\User.ssh\config to create a connection profile
- Please place the key pair pem file under the
~/.ssh/
folder
- After opening the config file, copy and paste the following format, and fill in the information of a VCS instance; if there are multiple instances, you can copy and paste several for modification. Save the file when finished.
Host <INSTANCE_NAME> # Enter the name of the VCS instance
HostName <PUBLIC_IP> # Enter Public IP
User <IMAGE_TYPE> # Enter ubuntu or centos
IdentityFile ~/.ssh/<.pem> # Enter .pem key pair name
Step 4. Connect to the VCS instance
- In VScode, click the icon in the lower left corner > select Remote-SSH: Connect to Host....
- It will show the instance information that have been created, click on it to start the connection.
- Then select Linux.
- Select Continue.
- When the connection is successful, the
SSH: <Host Name>
will appear in the lower left corner of the window.
- Then open Terminal > New Terminal to use the VCS instance!
For urgent debugging/system maintenance, it is recommended to connect via Console to speed up the workflow.
After connecting to the Linux instance:
- If you have attached the data disk in the file
/etc/fstab
(e.g.,/dev/vdb /mnt ext4 defaults
), we suggest you addnofail
after the configuration (for example:/dev/vdb /mnt ext4 defaults,nofail,x-systemd.device-timeout=1m
) to make sure that your instances can start and connect normally. - You will not be able to connect to VCS instance once the settings of the network interface card are modified. Therefore, we strongly discourage you from changing the NIC settings. Please beware when operating and deploying.