You can connect to a Windows Elastic Compute Service (ECS) instance by using a username and password from an on-premises client that runs a Windows, Linux, or macOS operating system. This topic describes how to connect to a Windows instance from an on-premises client.
Prerequisites
The instance to which you want to connect is in the Running state. If the instance is not in the Running state, start the instance. For more information, see Start an instance.
A logon password is specified for the instance. If you did not specify a password or if you forgot your password, you must reset the password for the instance. For more information, see Reset the logon password of an instance.
The instance can access the Internet:
To allow an instance that resides in a virtual private cloud (VPC) to access the Internet, you can assign a public IP address and purchase public bandwidth when you create the instance, or associate an elastic IP address (EIP) with the instance after the instance is created. For more information, see Create a VPC with an IPv4 CIDR block.
To allow an instance that resides in the classic network to access the Internet, you can assign a public IP address and purchase public bandwidth when you create the instance, or modify the public bandwidth configurations after the instance is created. For more information, see Modify the bandwidth configurations of subscription instances or Modify the bandwidth configurations of pay-as-you-go instances.
The rules described in the following table are added to the security group to which the instance belongs. For more information, see Add a security group rule.
Network type
Rule direction
Action
Port range
Priority
Authorization object
VPC
Inbound
Allow
To open the default port 3389 on the Windows instance, select RDP (3389).
To open other ports on the Windows instance, enter a port range.
1
The public IP address of your on-premises client, not the public IP address of the instance.
ImportantYou can specify 0.0.0.0/0 as the authorization object to allow inbound access from all IP addresses. However, this exposes your instance to security risks. Proceed with caution.
Classic network
Internet ingress
Connect to a Windows instance
Use one of the following methods based on the operating system of your on-premises client to connect to a Windows instance.
Connect from an on-premises client that runs a Windows operating system
If your on-premises client runs a Windows operating system, you can use Windows built-in Microsoft Terminal Services Client (MSTSC) to connect to a Windows instance from the client.
Use one of the following methods to start Remote Desktop Connection (MSTSC):
Choose
.Click the Start icon, enter mstsc in the search box, and then press the Enter key.
Press Win (Windows logo key)+R to open the Run dialog box, enter mstsc, and then press the Enter key.
In the Remote Desktop Connection dialog box, perform the following steps:
Click Show Options.
In the Computer field, enter the public IP address or EIP of the instance.
In the User name field, enter a username. The default username is Administrator.
If you do not want to manually enter your username and password the next time you connect to the instance, you can select Allow me to save credentials.
(Optional) If you want to copy files from your on-premises client to the instance, click the Local Resources tab to view the options for sharing on-premises computer resources.
If you want to copy only text, select Clipboard.
If you want to copy files, click More..., select Drives, and then select the letters of the drives from which you want to copy files.
(Optional) If you have specific requirements on the size of the remote desktop window, click the Display tab to resize the remote desktop window. We recommend that you use Full Screen.
Click Connect.
In the Remote Desktop Connection dialog box that displays the "Do you trust this remote connection?" message, click Connect.
Connect from an on-premises client that runs a Linux operating system
If your on-premises client runs a Linux operating system, you can use a remote connection tool to connect to a Windows instance from the client. In this example, rdesktop and an instance that runs a CentOS 7.9 operating system are used.
You must install a GUI on your Linux client. For information about how to install a GUI on your Linux client, see Installing a graphical desktop environment for a Linux instance.
Run the following commands to download and install rdesktop:
sudo yum -y install epel-release sudo wget http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm sudo rpm -Uvh nux-dextop-release*rpm sudo yum install rdesktop -y
Run the following command to connect to the Windows instance.
ImportantThe command must be run in a GUI.
The sample command is only for reference. Configure the parameters in the command based on your business requirements.
rdesktop -u administrator -p password -f -g 1024*720 192.168.1.1 -r clipboard:PRIMARYCLIPBOARD -r disk:sunray=/home/yz16184
The following table describes the parameters.
Parameter
Description
-u
The username to use to log on to the Windows instance. The default username is Administrator.
-p
The password to use to log on to the Windows instance.
-f
The full-screen mode. You can press Ctrl+Alt+Enter to switch the mode.
-g
The screen resolution. An asterisk (*) is used between the pixel width and height. This parameter can be left empty. If this parameter is not specified, the full-screen mode is used.
192.168.1.1
The IP address of the instance to which you want to connect. Set this parameter to the public IP address or EIP of your Windows instance.
-d
The domain name. For example, if the domain name is INC, set this parameter to
-d inc
.-r
Multimedia redirection. Examples:
-r sound
: turns on sound.-r sound : local
: uses a local sound card.-r disk:usb=/mnt/usbdevice
: enables the USB flash drive.
-r clipboard:PRIMARYCLIPBOARD
Allows text, including Chinese characters, to be copied between the on-premises client that runs a Linux operating system and the Windows instance.
-r disk:sunray=/home/yz16184
Maps a directory on the on-premises client that runs a Linux operating system to a disk on the Windows instance. This eliminates the need for Samba and FTP to transfer files.
Connect from an on-premises client that runs a macOS operating system
For information about how to connect to a Windows instance from an on-premises client that runs a macOS operating system, see Get started with the macOS client in the Microsoft official documentation.
References
If you do not want to connect to a Windows instance by using a username and password from an on-premises client, you can log on to the ECS console and then log on to the Windows instance by using Workbench. For more information, see Connect to a Windows instance by using a password or key.