Troubleshoot issues connecting to your Amazon EC2 Windows instance (original) (raw)

The following information and common errors can help you troubleshoot issues when connecting to your Windows instance.

Connection issues

Remote Desktop can't connect to the remote computer

Try the following to resolve issues related to connecting to your instance:

Error using the macOS RDP client

If you are connecting to a Windows Server instance using the Remote Desktop Connection client from the Microsoft website, you may get the following error:

Remote Desktop Connection cannot verify the identity of the computer that you want to connect to.

Download the Microsoft Remote Desktop app from the Mac App Store and use the app to connect to your instance.

RDP displays a black screen instead of the desktop

Try the following to resolve this issue:

mstsc /v:instance /admin  

Unable to remotely log on to an instance with a user that is not an administrator

If you are not able to remotely log on to a Windows instance with a user that is not an administrator account, ensure that you have granted the user the right to log on locally. See Grant a user or group the right to log on locally to the domain controllers in the domain.

Troubleshooting Remote Desktop issues using AWS Systems Manager

You can use AWS Systems Manager to troubleshoot issues connecting to your Windows instance using RDP.

AWSSupport-TroubleshootRDP

The AWSSupport-TroubleshootRDP automation document allows the user to check or modify common settings on the target instance that can impact Remote Desktop Protocol (RDP) connections, such as the RDP Port, Network Layer Authentication (NLA), and Windows Firewall profiles. By default, the document reads and outputs the values of these settings.

The AWSSupport-TroubleshootRDP automation document can be used with EC2 instances, on-premises instances, and virtual machines (VMs) that are enabled for use with AWS Systems Manager (managed instances). In addition, it can also be used with EC2 instances for Windows Server that are not enabled for use with Systems Manager. For information about enabling instances for use with AWS Systems Manager, seeManaged nodes in the_AWS Systems Manager User Guide_.

To troubleshoot using the AWSSupport-TroubleshootRDP document
  1. Log in to the Systems Manager Console.
  2. Verify that you are in the same Region as the impaired instance.
  3. Choose Documents from the left navigation pane.
  4. On the Owned by Amazon tab, enterAWSSupport-TroubleshootRDP in the search field. When theAWSSupport-TroubleshootRDP document appears, select it.
  5. Choose Execute automation.
  6. For Execution Mode, choose Simple execution.
  7. For Input parameters,InstanceId, enable Show interactive instance picker.
  8. Choose your Amazon EC2 instance.
  9. Review the examples, then choose Execute.
  10. To monitor the execution progress, for Execution status, wait for the status to change fromPending to Success. ExpandOutputs to view the results. To view the output of individual steps, in Executed Steps, choose an item from Step ID.

AWSSupport-TroubleshootRDP examples

The following examples show you how to accomplish common troubleshooting tasks using AWSSupport-TroubleshootRDP. You can use either the example AWS CLI start-automation-execution command or the provided link to the AWS Management Console.

Example: Check the current RDP status

AWS CLI:

aws ssm start-automation-execution --document-name "AWSSupport-TroubleshootRDP" --parameters "InstanceId=i-1234567890abcdef0, Action=Custom" --region region_code

AWS Systems Manager console:

https://console.aws.amazon.com/systems-manager/automation/execute/AWSSupport-TroubleshootRDP?region=region#documentVersion=$LATEST
Example: Disable the Windows Firewall

AWS CLI:

aws ssm start-automation-execution --document-name "AWSSupport-TroubleshootRDP" --parameters "InstanceId=i-1234567890abcdef0, Action=Custom, Firewall=Disable" --region region_code

AWS Systems Manager console:

https://console.aws.amazon.com/systems-manager/automation/execute/AWSSupport-TroubleshootRDP?region=region_code#documentVersion=$LATEST&Firewall=Disable
Example: Disable Network Level Authentication

AWS CLI:

aws ssm start-automation-execution --document-name "AWSSupport-TroubleshootRDP" --parameters "InstanceId=i-1234567890abcdef0, Action=Custom, NLASettingAction=Disable" --region region_code

AWS Systems Manager console:

https://console.aws.amazon.com/systems-manager/automation/execute/AWSSupport-TroubleshootRDP?region=region_code#documentVersion
Example: Set RDP Service Startup Type to Automatic and start the RDP service

AWS CLI:

aws ssm start-automation-execution --document-name "AWSSupport-TroubleshootRDP" --parameters "InstanceId=i-1234567890abcdef0, Action=Custom, RDPServiceStartupType=Auto, RDPServiceAction=Start" --region region_code

AWS Systems Manager console:

https://console.aws.amazon.com/systems-manager/automation/execute/AWSSupport-TroubleshootRDP?region=region_code#documentVersion=$LATEST&RDPServiceStartupType=Auto&RDPServiceAction=Start
Example: Restore the default RDP Port (3389)

AWS CLI:

aws ssm start-automation-execution --document-name "AWSSupport-TroubleshootRDP" --parameters "InstanceId=i-1234567890abcdef0, Action=Custom, RDPPortAction=Modify" --region region_code

AWS Systems Manager console:

https://console.aws.amazon.com/systems-manager/automation/execute/AWSSupport-TroubleshootRDP?region=region_code#documentVersion=$LATEST&RDPPortAction=Modify
Example: Allow remote connections

AWS CLI:

aws ssm start-automation-execution --document-name "AWSSupport-TroubleshootRDP" --parameters "InstanceId=i-1234567890abcdef0, Action=Custom, RemoteConnections=Enable" --region region_code

AWS Systems Manager console:

https://console.aws.amazon.com/systems-manager/automation/execute/AWSSupport-TroubleshootRDP?region=region_code#documentVersion=$LATEST&RemoteConnections=Enable

AWSSupport-ExecuteEC2Rescue

The AWSSupport-ExecuteEC2Rescue automation document uses EC2Rescue for Windows Server to automatically troubleshoot and restore EC2 instance connectivity and RDP issues. For more information, see Run the EC2Rescue tool on unreachable instances.

The AWSSupport-ExecuteEC2Rescue automation document requires a stop and restart of the instance. Systems Manager Automation stops the instance and creates an Amazon Machine Image (AMI). Data stored in instance store volumes is lost. The public IP address changes if you are not using an Elastic IP address. For more information, see Run the EC2Rescue tool on unreachable instances in the_AWS Systems Manager User Guide_.

To troubleshoot using the AWSSupport-ExecuteEC2Rescue document
  1. Open the Systems Manager console.
  2. Verify that you are in the same Region as the impaired Amazon EC2 instance.
  3. In the navigation panel, choose Documents.
  4. Search for and select the AWSSupport-ExecuteEC2Rescue document, and then choose Execute automation.
  5. In Execution Mode, choose Simple execution.
  6. In the Input parameters section, forUnreachableInstanceId, enter the Amazon EC2 instance ID of the unreachable instance.
  7. (Optional) For LogDestination, enter the Amazon Simple Storage Service (Amazon S3) bucket name if you want to collect operating system logs for troubleshooting your Amazon EC2 instance. Logs are automatically uploaded to the specified bucket.
  8. Choose Execute.
  9. To monitor the execution progress, in Execution status, wait for the status to change from Pending to Success. Expand Outputs to view the results. To view the output of individual steps, inExecuted Steps, choose theStep ID.

Enable Remote Desktop on an EC2 instance with remote registry

If your unreachable instance is not managed by AWS Systems Manager Session Manager, then you can use remote registry to enable Remote Desktop.

  1. From the EC2 console, stop the unreachable instance.
  2. Detach the root volume of the unreachable instance and attach it to a reachable instance in the same Availability Zone as a storage volume. If you don't have a reachable instance in the same Availability Zone, launch one. Note the device name of the root volume on the unreachable instance.
  3. On the reachable instance, open Disk Management. You can do so by running the following command in the Command Prompt window.
diskmgmt.msc  
  1. Right click the newly attached volume that came from the unreachable instance, and then chooseOnline.
  2. Open the Windows Registry Editor. You can do so by running the following command in the Command Prompt window.
regedit  
  1. In Registry Editor, choose HKEY_LOCAL_MACHINE, then selectFile, Load Hive.
  2. Select the drive of the attached volume, navigate to \Windows\System32\config\, select SYSTEM, and then choose Open.
  3. For Key Name, enter a unique name for the hive and choose OK.
  4. Back up the registry hive before making any changes to the registry.
    1. In the Registry Editor console tree, select the hive that you loaded: HKEY_LOCAL_MACHINE\your-key-name.
    2. Choose File, Export.
    3. In the Export Registry File dialog box, choose the location to which you want to save the backup copy, and then type a name for the backup file in the File name field.
    4. Choose Save.
  5. In Registry Editor, navigate to HKEY_LOCAL_MACHINE\`your key name`\ControlSet001\Control\Terminal Server, and then, in the details pane, double-click fDenyTSConnections.
  6. In the Edit DWORD value box, enter 0 in the Value data field.
  7. Choose OK.
Note

If the value in the Value data field is 1, then the instance will deny remote desktop connections. A value of 0 allows remote desktop connections. 13. In Registry Editor, chooseHKEY_LOCAL_MACHINE\your-key-name, then select File, Unload Hive. 14. Close Registry Editor and Disk Management. 15. From the EC2 console, detach the volume from the reachable instance and then reattach it to the unreachable instance. When attaching the volume to the unreachable instance, enter the device name that you saved earlier in the device field. 16. Restart the unreachable instance.

I've lost my private key. How can I connect to my Windows instance?

When you connect to a newly-launched Windows instance, you decrypt the password for the Administrator account using the private key for the key pair that you specified when you launched the instance.

If you lose the Administrator password and you no longer have the private key, you must reset the password or create a new instance. For more information, see Reset the Windows administrator password for an Amazon EC2 Windows instance. For steps to reset the password using an Systems Manager document, see Reset passwords and SSH keys on EC2 instances in the_AWS Systems Manager User Guide_.