Change RDP port in Lightsail server and now no connection

0

I changed my Lightsail Windows instance RDP port from 3389 to 1789. But I forgot to change Windows Firewall policy to allow port 1789. Now I can't connect to my Lightsail windows from RDP client. I tried using Web Browser to connect via my Lightsail console and got following message:

An error occurred and we were unable to connect or stay connected to your instance. If this instance has just started up, try again in a minute or two.

UPSTREAM_NOT_FOUND [519]

Please help me to gain access to my lightsale windows instance again.

asked 2 months ago353 views
2 Answers
1
Accepted Answer

Just in case someone needs this for solution. This is what I did to gain back my instance

  1. Take a snapshot of the current locked out instant
  2. Create a new instance from that snapshot. During this instance creation step, there is an option to launch script. In that you can add powershell script to change back to port 3389. The script is like this
<powershell>
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\" -Name PortNumber -Value 3389
</powershell>
<persist>true</persist>
  1. After your instance created, try to log in your server with the RDP with default port 3389
  2. After that, delete your old instance and move your static IP to new instance.

That's it. You will get your server back.

answered 2 months ago
  • Glad you found the powershell tweak needed in addition to the steps from my response to work.

0

Hi,

The Lightsail in-Browser RDP attempts RDP connection only on port 3389. So you won't be able to use that to establish a RDP connection on any other port.

If you are also unable to establish a remote desktop connection via your own client, one option to recover data from the instance would be to create a snapshot of the instance [1] and a new instance from that snapshot [2] which would hopefully start with 3389 as the RDP port again. [Update: while creating this new instance please check if the launch-script shared by delphiman here works to reset the RDP port]

If the new instance also doesn't default back to RDP port as 3389, then the only way to recover data from the instance is to create a snapshot of it's root disk, create a new volume from this disk-snapshot and copy data over from that new volume attached to a recovery new instance [3].

Docs:
[1] Create instance snapshot - https://docs.aws.amazon.com/lightsail/latest/userguide/prepare-windows-based-instance-and-create-snapshot.html
[2] Create a new instance from that snapshot - https://docs.aws.amazon.com/lightsail/latest/userguide/lightsail-how-to-create-instance-from-snapshot.html
[3] Create a root disk snapshot - https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-create-an-instance-root-volume-snapshot.html

Thanks

profile pictureAWS
EXPERT
AWS-SUM
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions