Change RDP port in Lightsail server and now no connection


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.


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

asked 2 months ago353 views
2 Answers
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
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\" -Name PortNumber -Value 3389
  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.



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].

[1] Create instance snapshot -
[2] Create a new instance from that snapshot -
[3] Create a root disk snapshot -


profile pictureAWS
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