

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 连接到通过 Lightsail 快照创建的 Windows 服务器亚马逊 EC2 实例
<a name="amazon-lightsail-connecting-to-windows-server-amazon-ec2-instances"></a>

在 Amazon Elastic Compute Cloud（Amazon EC2）中创建新的 Windows Server 实例后，您可以使用远程桌面协议（RDP）连接到该实例。这与您连接到源 Amazon Lightsail 实例的方式类似。使用源实例的默认 Lightsail 密钥对连接到你的 EC2 实例。 AWS 区域本指南向您介绍如何使用 Microsoft 远程桌面连接功能连接到您的 Windows Server 实例。

**注意**  
有关连接到 Linux 或 Unix 实例的更多信息，请参阅[连接通过 Lightsail 快照创建的 Amazon EC2 中的 Linux 或 Unix 实](amazon-lightsail-connecting-to-linux-unix-amazon-ec2-instances.md)例。

**内容**
+ [获取实例的密钥](#get-the-key-windows-instance)
+ [获取实例的公有 DNS 地址](#get-the-public-dns-address-for-your-windows-instance)
+ [获取 Windows Server 实例的密码](#get-the-password-for-your-windows-instance)
+ [配置远程桌面连接以连接到 Windows Server 实例](#configure-remote-desktop-connection)
+ [后续步骤](#connecting-to-windows-server-amazon-ec2-instances-next-steps)

## 获取实例的密钥
<a name="get-the-key-windows-instance"></a>

您在亚马逊 EC2 中的 Windows 服务器实例使用源实例所在区域的默认 Lightsail 密钥对来检索默认管理员密码。

从 [Lightsail 账户](https://lightsail.aws.amazon.com/ls/webapp/account/keys)页面**的 SSH 密钥**选项卡下载默认私钥。有关默认 Lightsail SSH 密钥的更多信息，请参阅 [SSH 密钥](understanding-ssh-in-amazon-lightsail.md)对。

**注意**  
连接到您的 EC2 实例后，我们建议您更改 Amazon EC2 中 Windows Server 实例的管理员密码。它会移除默认 Lightsail 密钥对与亚马逊 EC2 中的 Windows 服务器实例之间的关联。有关更多信息，请参阅[保护根据 Lightsail 快照创建的 Amazon EC2 Windows 服务器实例](amazon-lightsail-securing-windows-server-amazon-ec2-instances.md)。

## 获取实例的公有 DNS 地址
<a name="get-the-public-dns-address-for-your-windows-instance"></a>

获取 Amazon EC2 实例的公有 DNS 地址，以便在配置 RDP 客户端（如 Microsoft 远程桌面连接）时可以使用它连接到您的实例。

**获取实例的公有 DNS 地址**

1. 登录 [Amazon EC2 控制台](https://console.aws.amazon.com/ec2/)。

1. 从左侧导航窗格中选择**实例**。

1. 选择要连接的正在运行的 Windows Server 实例。

1. 在下方窗格中，找到实例的**公有 DNS** 地址。

   这是在配置 RDP 客户端来连接实例时需要使用的地址。继续阅读本指南的[获取 Windows Server 实例的密码](#get-the-password-for-your-windows-instance)部分，以了解如何获取 Amazon EC2 中 Windows Server 实例的默认管理员密码。  
![\[Amazon EC2 控制台中某个实例的公有 DNS。\]](http://docs.aws.amazon.com/zh_cn/lightsail/latest/userguide/images/amazon-lightsail-ec2-public-dns.png)

## 获取 Windows Server 实例的密码
<a name="get-the-password-for-your-windows-instance"></a>

从 Amazon EC2 控制台获取 Windows Server 实例的密码。通过 RDP 连接到 Windows Server 实例时，您需要此密码来登录该实例。

**获取 Windows Server 实例的密码**

1. 登录 [Amazon EC2 控制台](https://console.aws.amazon.com/ec2/)。

1. 从左侧导航窗格中选择**实例**。

1. 选择要连接的 Windows Server 实例。

1. 对于**操作**，请选择 **Security (安全)**，然后选择 **Get Windows Password (获取 Windows 密码)**。  
![\[在 Amazon EC2 控制台中获取 Windows Server 默认管理员密码。\]](http://docs.aws.amazon.com/zh_cn/lightsail/latest/userguide/images/amazon-lightsail-ec2-get-windows-password.png)

1. 出现提示时，选择 “**浏览**”，然后打开本指南前面部分从 Lightsail 下载的默认私钥文件。

1. 选择 **Decrypt Password**。  
![\[在 Amazon EC2 控制台中解密 Windows 默认管理员密码。\]](http://docs.aws.amazon.com/zh_cn/lightsail/latest/userguide/images/amazon-lightsail-ec2-decrypt-password.png)

   将显示密码、用户名和私有 IP 地址。将密码复制到剪贴板，以便在本指南接下来的[配置远程桌面连接以连接到 Windows Server 实例](#configure-remote-desktop-connection)部分使用。请突出显示该密码，如果您使用 Windows，请按 **Ctrl\$1C**；如果您使用 macOS，请按 **Cmd\$1C**。  
![\[在 Amazon EC2 控制台中解密 Windows 默认管理员密码。\]](http://docs.aws.amazon.com/zh_cn/lightsail/latest/userguide/images/amazon-lightsail-ec2-decrypted-password.png)

   继续阅读本指南的[配置远程桌面连接以连接到 Windows Server 实例](#configure-remote-desktop-connection)部分，了解如何配置远程桌面连接以连接到 Amazon EC2 中的 Windows Server 实例。

## 配置远程桌面连接以连接到 Windows Server 实例
<a name="configure-remote-desktop-connection"></a>

远程桌面连接是在大多数 Windows 操作系统中预装的 RDP 客户端。使用它能够以图形化方式连接到 Amazon EC2 中的 Windows Server 实例。

**配置远程桌面连接以连接到 Windows Server 实例**

1. 打开远程桌面连接。

   例如，选择 **Windows 开始**菜单，然后搜索**远程桌面连接**。

1. 在**计算机**文本框中，输入您在本指南前文部分从 Amazon EC2 获取的 Windows Server 实例的公有 DNS 地址。

1. 选择**显示选项**以查看更多选项。

1. 在**用户名**文本框中输入 `Administrator`。  
![\[Microsoft 远程桌面连接。\]](http://docs.aws.amazon.com/zh_cn/lightsail/latest/userguide/images/amazon-lightsail-rdc-configuration.png)

1. 选择**连接**以连接到您的 Windows Server 实例。

1. 根据 Windows 安全提示，将 Windows Server 实例的密码输入**密码**文本框，然后选择**确定**。  
![\[Microsoft 远程桌面连接密码提示。\]](http://docs.aws.amazon.com/zh_cn/lightsail/latest/userguide/images/amazon-lightsail-rdc-password.png)

1. 根据远程桌面连接提示，选择**是**以进行连接。  
![\[Microsoft 远程桌面连接安全提示。\]](http://docs.aws.amazon.com/zh_cn/lightsail/latest/userguide/images/amazon-lightsail-rdc-certificate-errors.png)

   如果您已成功连接到实例，应该会看到与以下屏幕相似的屏幕：  
![\[Microsoft 远程桌面连接已连接到实例。\]](http://docs.aws.amazon.com/zh_cn/lightsail/latest/userguide/images/amazon-lightsail-rdc-connected.png)

## 后续步骤
<a name="connecting-to-windows-server-amazon-ec2-instances-next-steps"></a>

我们建议您更改 Amazon EC2 中 Windows Server 实例的管理员密码。它会移除默认 Lightsail 密钥对与亚马逊 EC2 中的 Windows 服务器实例之间的关联。有关更多信息，请参阅[保护通过 Lightsail 快照创建的 Amazon EC2 中的 Windows 服务器实例](amazon-lightsail-securing-windows-server-amazon-ec2-instances.md)。