Access an Instance
Background Information
After creating elastic compute instances, you need to remote control and manage them. Several remote access methods are listed below.
RDP (Remote Desktop Protocol) RDP is a remote desktop protocol commonly used for remote management of Windows operating systems. You're recommended to remote connect to a Windows virtual machine via RDP.
SSH (Secure Shell) SSH is a command-line based remote management tool that uses a secure network protocol. SSH is widely used in UNIX-like operating systems, including Linux, BSD, and macOS. You're recommended to use Terminal or Windows PowerShell to establish an SSH connection to non-Windows virtual machines.
RFB (Remote FrameBuffer) RFB is a protocol used for graphical remote management. VNC (Virtual Network Computing) is a common remote graphical management tool based on the RFB protocol used in UNIX-like operating systems. VNC login provides a graphical desktop environment, allowing you to interact with the virtual machine visually. VNC protocol is also widely supported across multiple operating systems and platforms, which is more flexible and compatible. You're recommended to remotely access and control the graphical interface of your virtual machines via VNC.
These protocols and tools offer various ways to remotely access and manage your instances. RDP provides a graphical interface for Windows instances; SSH offers a command-line interface for remote management of UNIX-like instances, and VNC enables graphical remote management of instances regardless of operating systems.
Access a Linux Instance via SSH Key Pair
When you need to access a Linux instance, you can use SSH. Assume a macOS Terminal and a Windows PowerShell.
If you have deployed the SSH public key to your server, you can also using the SSH key for authentication without entering a password.
Prerequisites
Ensure the instance has SSH enabled and is running.
The instance you want to access must has a public IP address unless the accessing computer and the target instance are on the same private network.
Procedures
Open the Terminal application on your macOS computer. You can find it in the Applications > Utilities folder, or you can use Spotlight to search for it.
In the Terminal, use the SSH command along with the IP address of the instance to establish a remote connection. The command syntax is as follows:
ssh username@ip_addressPress Enter, and Terminal will attempt to establish an SSH connection to the instance. If this is your first time connecting to the virtual machine, you may be prompted to confirm the authenticity of the host by verifying its key fingerprint. Type
yesto proceed.After the SSH connection is successfully established, you will be prompted to enter the password for the selected username on the instance.
Once authenticated, you will have a Terminal session open on your macOS computer, but with the remote instance's command-line interface. From here, you can execute commands and perform administrative tasks on the instance.
Prerequisites
Ensure that the instance has PowerShell Remoting enabled and is running. PowerShell Remoting is available by default on Windows operating systems.
The instance you want to access must has a public IP address unless the accessing computer and the target instance are on the same private network.
Procedures
Open the Windows PowerShell application on your Windows computer. You can do this by searching for "PowerShell" in the Start menu or by pressing
Win + Xand selecting Windows PowerShell or Windows PowerShell (Admin).In the PowerShell console, use the following command to establish a remote session with the instance:
Enter-PSSession -ComputerName ip_address -Credential usernamePress Enter, and you will be prompted to enter the password for the selected username on the instance.
Once authenticated, you will have a PowerShell session open on your local computer, but with the remote instance's command-line interface. From here, you can execute PowerShell commands and perform administrative tasks on the instance.
Prerequisites
The instance you want to access must has a public IP address unless the accessing computer and the target instance are on the same private network.
Procedures
Generate an SSH key pair by running the following command on your local computer:
ssh-keygen -t rsa -b 4096This will generate a 4096-bit RSA key pair, including a private key and a public key. By default, they will be saved in the
~/.sshdirectory.Use the following command to retrieve the generated public key:
cat ~/.ssh/id_rsa.pubThis will display your public key. Copy it.
Use the SSH command along with the IP address to access the instance:
ssh username@ip_addressPress Enter. This will attempt to establish an SSH connection to the instance. If this is your first time connecting to the virtual machine, you may be prompted to confirm the authenticity of the host by verifying its key fingerprint. Type
yesto proceed.After the SSH connection is successfully established, you will be prompted to enter the password for the selected username on the instance.
On the instance, open the
~/.ssh/authorized_keysfile (create it if it doesn't exist). You can open the file using the following command:nano ~/.ssh/authorized_keysPaste the previously retrieved public key into the file and save it.
Result
You can now access the instance using the SSH key pair. Run the following command:
ssh -i ~/.ssh/id_rsa username@ip_addressThis will authenticate using the private key without requiring a password.
Access a Windows Instance via RDP
When you need to access a Windows instance, you're recommended to use RDP.
Prerequisites
Ensure that the Windows instance is running and has RDP enabled. RDP is available by default on Windows operating systems.
The instance you want to access must has a public IP address unless the accessing computer and the target instance are on the same private network.
Procedures
Open the Remote Desktop client application on your local computer. This application is built into Windows, and you can find it by searching for "Remote Desktop" in the Start menu.
In the Remote Desktop client, enter the public IP address of the instance in the "Computer" field.
Click Connect to initiate the connection.
If prompted, enter the credentials for the user account on the instance.
Once authenticated, the Remote Desktop client will establish a connection to the Windows instance. You will see the instance's desktop displayed on your local computer.
You can now interact with the Windows instance as if you were sitting in front of it. You can run applications, access files, configure settings, and perform any other tasks you would normally do on a Windows desktop.
Remember to ensure that the necessary firewall rules are configured on both the instance and your local machine to allow RDP connections.
Access an Instance via VNC
You can remote access a Linux or Windows instance via VNC.
Prerequisites
The instance you want to access must has a public IP address unless the accessing computer and the target instance are on the same private network.
Go to elastic compute instance list page and click on the desired instance to enter Details page.
Click VNC Access to enter VNC access interface. Wait until it shows:
Connected (encrypted) to: QEMU (instance-xxxxxxxx)Enter the default username, and press Enter, and Terminal will attempt to establish an SSH connection.
Enter the password for the instance.
Once authenticated, the VNC will establish a connection to the instance. You should see the VM's desktop or graphical interface displayed in the VNC client window.
(optional) You can paste your code on the Clipboard and click Run to quick run your command.
Go to elastic compute instance list page and click on the desired instance to enter Details page.
Click VNC Access to enter VNC access interface. Wait until it shows:
Connected (encrypted) to: QEMU (instance-xxxxxxxx)Go to Keyboard Shortcuts > Ctrl+Alt+Del.
Click Clipboard, enter the password and click Run.
Summary
The protocols and access methods mentioned above provide convenience and flexibility in different scenarios. You can choose the way that best suits your needs to remotely access and manage your elastic compute instances, whether it's using a graphical user interface or a command-line interface.
Last updated