First thing you should do if you are hosting a server in AWS cloud is to change its default ports.
Why one should do that?
- Does changing default port number actually increase security?
- The 5 biggest security mistakes users make in Amazon’s cloud
- AWS Security Alert: Insecure RDP Server Configuration
Steps to change the RDP port for EC2 server. YOU NEED TO PERFORM ALL BELOW STEPS IN THE SAME SEQUENCE ELSE YOU CAN LOSE SERVER/ RDP ACCESS.
1. Configure your Security Group and allow inbound access to the custom port you want to use for RDP (Say 7777). You can get more information about the Security Groups here.
Once done, next step is to open up the port 7777 from the server firewall so that external system can connect on this port.
You can manually open up the port from the Firewall settings or you can run following command if you have admin access.
netsh advfirewall firewall add rule name=“Custom RDP Port“ dir=in action=allow protocol=TCP localport=7777
Last step is to change the RDP listening Port:
To change the port that Remote Desktop listens on, follow these steps.
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
- Start Registry Editor.
- Locate and then click the following registry subkey:
- On the Edit menu, click Modify, and then click Decimal.
- Type the new port number(7777 in our case), and then click OK.
- Quit Registry Editor.
- Restart the computer.