跳至内容

为什么我无法使用 Fleet Manager 远程桌面连接到 Amazon EC2 Windows 实例?

3 分钟阅读
0

我想使用 Fleet Manager(AWS Systems Manager 的一项功能)通过远程桌面协议 (RDP) 连接到 Amazon Elastic Compute Cloud (Amazon EC2) Windows 实例。

解决方法

**先决条件:**验证您是否满足以下条件:

  • 实例满足环境要求。在使用远程桌面之前,必须先执行此操作。
  • 实例在 Systems Manager 控制台中列出。您的实例必须在 Fleet Manager 部分的托管节点下方列出。
  • AWS Systems Manager Agent (SSM Agent) 的 ping 状态为在线。如果您的实例在 Systems Manager 中未显示为托管,或者 ping 状态为连接丢失,请对离线 SSM Agent 进行故障排除。

根据您在连接到实例时收到的错误,对连接问题进行故障排除。

排查 "AccessDeniedException" 错误

您用于访问 Systems Manager 控制台的 AWS Identity and Access Management (IAM) 用户或角色必须具有执行以下操作的权限:

  • ssm-guiconnect:CancelConnection
  • ssm-guiconnect:GetConnection
  • ssm-guiconnect:StartConnection

以下错误表示您未配置所需的权限:

"AccessDeniedException: User: arn:aws:iam::123456789:user/ssmtest is not authorized to perform: ssm-guiconnect:StartConnection on resource: arn:aws:ec2:us-west-2:123456789:instance/*"

要解决此错误,请配置所需的权限。

排查 "Unable to establish Remote Desktop connection" 错误

Fleet Manager 远程桌面窗口可能会显示以下错误消息:

"Unable to establish Remote Desktop connection.Verify that valid credentials were provided, and that the user you specified has been granted permission to log in through Remote Desktop."

此错误表示存在以下问题之一:

  • 用户名或密码不正确。
  • AWS 账户已停用。
  • 默认 RDP 端口 (3389) 已更改。
  • 本地或域账户密码已过期。
  • 网络级别身份验证 (NLA) 导致身份验证错误。
  • 远程桌面服务已重启或停止。

要解决此错误,请执行以下操作:

  • 检查并确保您输入的凭证正确无误。

  • 验证用户账户在 Active Directory、本地用户和组管理中是否处于活动状态。

  • 运行以下 PowerShell 命令,检查 RDP 端口是否设置为 3389:

    PS> (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber").PortNumber

    如果该端口未设置为 3389,请运行以下 PowerShell 命令来配置正确的默认端口:

    PS> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value 3389  
    PS> Restart-Service TermService -force
  • 使用 RDP 客户端从其他账户连接到实例。如果您的本地账户密码已过期,请使用 lusrmgr.msc 工具重置密码。如果您的域账户密码已过期,请联系域管理员或系统管理员重置密码。

  • 完成如何排查使用 RDP 连接到 EC2 Windows 实例时的身份验证错误?中服务器已启用 NLA 部分的解决步骤

  • 运行以下 PowerShell 命令,重新启动远程桌面服务:

    PS> Get-Service TermService  
    PS> Start-Service TermService

排查 "The remote desktop connection request timed out" 错误

以下错误消息表示您必须将 SSM Agent 更新到较新版本。导致此错误消息的其他问题包括 CPU 使用率高、内存耗尽和磁盘空间不足:

"The remote desktop connection request timed out.Please try again."

要解决此错误,请执行以下操作:

  1. 验证节点是否运行 SSM Agent 版本 3.0.222.0 或更高版本。要检查托管节点上安装的 SSM Agent 的版本号,请参阅检查 SSM Agent 版本号。要安装或更新 SSM Agent,请参阅使用 SSM Agent。
  2. 检查您的 Amazon CloudWatch 指标是否存在 CPU 使用率过高。如果您的使用率接近 100%,请使用 RDP 客户端来识别并排查占用过多 CPU 资源的进程。如果您无法登录,请重启实例。成功重启实例后,对 CPU 使用率高的问题进行故障排除。
  3. 检查操作系统级别的内存使用率是否过高。如果内存已耗尽,请重启实例。
  4. 如果您在重启实例后仍然收到此错误,请检查根卷中是否有足够的磁盘空间。

排查 "The connection has been terminated due to inactivity" 错误

"The connection has been terminated due to inactivity" 错误表示您的 RDP 连接在空闲超过 10 分钟后已断开连接。验证您在断开远程桌面连接期间应用的条件是否会导致 RDP 断开连接。

对 60 分钟后断开连接的问题进行故障排除

默认情况下,Fleet Manager 会话会在 60 分钟后断开连接。要检查您的会话是否因达到持续时间限制而断开连接,请查看有关连接历史记录的信息。查找与实例的连接 ID 相对应的 Time Limit Exceeded(超出时间限制)状态。

要保持会话连接,请在远程桌面断开连接之前,打开 Actions(操作)菜单,然后从下拉列表中选择 Renew session(续订会话)。然后,输入您的用户名和密码,并选择 Renew session(续订会话)按钮。续订连接后,持续时间计时器会重置。

您的 RDP 会话连接也可能因 Amazon EC2 从现有活动 RDP 会话关闭或重启而终止。

排查 "TargetNotConnected" 错误

以下错误表示您的实例在连接时处于离线状态或进入启动状态:

"400: The StartSession API operation didn't succeed: An error occurred (TargetNotConnected) when calling the StartSession operation: example_instance_id is not connected."

验证您的实例在通过两项状态检查后是否处于正在运行状态,并且其在 Fleet Manager 中的 ping 状态是否为在线。

排查单点登录 (SSO) 登录错误

以下错误表示在您请求授权的位置未配置或不支持 SSO:

"An error occurred while establishing the Remote Desktop Connection.The system cannot create an operating system for the SSO Login.The SSO functionality is not supported on the Domain controllers.You can only connect with username/password method."

要解决此错误,请使用用户名和密码连接到实例,或联系您所在组织的域管理员。

相关信息

AWS Systems Manager Fleet Manager

AWS 官方已更新 10 个月前