Skip to content

Connecting to a windows server using port forwarding

0

I'm trying to connect to a windows server (2022) ec2 instance in a private subnet using ssm, port forwarding, and rdp. Is there a default username and password? I've learned that I can use ssm to create a user, add them to the Administrators group, and then rdp that way, but is there a way to avoid this?

asked 2 years ago627 views

2 Answers
1

Yes, you can connect to a Windows Server 2022 EC2 instance in a private subnet using SSM, port forwarding, and RDP without creating a new user. Here's how you can do it:

  1. First, ensure you have the AWS CLI and Session Manager plugin installed and configured on your local machine.

  2. Use the AWS CLI to start a port forwarding session. Run a command like this:

    aws ssm start-session --target i-1234567890abcdef0 --document-name AWS-StartPortForwardingSession --parameters "portNumber"=["3389"],"localPortNumber"=["56789"]

    Replace "i-1234567890abcdef0" with your actual instance ID, and you can change "56789" to any available local port you prefer.

  3. Once the session is established, open your RDP client (like Remote Desktop Connection on Windows) and connect to localhost:56789.

  4. For the login credentials, you'll use the default administrator account. The username is typically "Administrator", but it can vary based on the language of the operating system. For example, it might be "Administrateur" for French or "Administrador" for Portuguese.

  5. For the password, you'll need to retrieve the initial administrator password that was generated when the instance was launched. You can get this from the EC2 console:

    • Go to the EC2 console and select your instance
    • Choose "Connect"
    • Select the "RDP Client" tab
    • Click on "Get Password"
    • You'll need to use the private key associated with the key pair you selected when launching the instance to decrypt the password.

Remember, it's a best practice to change this initial password after your first login for security reasons.

By using this method, you can connect to your Windows Server instance using RDP through SSM port forwarding without needing to create a new user or modify the instance configuration.
Sources
Start a session - AWS Systems Manager
Connect to your Windows instance using an RDP client - Amazon Elastic Compute Cloud
Post-deployment steps - AWS Launch Wizard
aws instance launch password problem | AWS re:Post

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Are you sure for your ssm command? For the tunneling I am using a different syntax for the parameters. Yours isn't working on my side (MacOS)

    aws ssm start-session --target <INSTANCE_ID> --document-name AWS-StartPortForwardingSession --parameters=localPortNumber= 55679,portNumber=3389
0

Are you able to use SSM Session Manager from EC2 console as per documentation: Connect to your Amazon EC2 instance using Session Manager ?

If you can, use it to set administrator password, e.g. net user administrator <STRONG_PASSWORD> where <STRONG_PASSWORD> is the password you specify.

If yes, you should be able to connect using Fleet Manager Remote Desktop. Login as administrator and the password you specify.

More information from blog Console-based access to Windows instances using AWS Systems Manager Fleet Manager

AWS
EXPERT

answered 2 years 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.