Start a new topic
Answered

AWS SSM for RDP

We are required to connect via AWS SSM to our Windows Servers using the port tunneling feature as described on https://awscloudsecvirtualevent.com/workshops/module1/rdp/

I setup a task that runs the command line to make the SSM connection, however as it takes a few seconds to launch terminal and connect, as a result the RDP connection fails. Is there a way to put a pause before the RDP connect trys to connect? I did try the wait for completion, but as SSM has to stay open in the terminal window it never completes.


Daniel


Best Answer

Create a task with the following settings


General

Check Run in Terminal

Check No confirmation required

Command

macOS

command: osascript

Arguments: -e 'tell application "Terminal" to do script "aws ssm start-session --target i-xxxxxxxxxxxxxxxxx --document-name AWS-StartPortForwardingSession --parameters \"localPortNumber=9999,portNumber=3389\" --region us-east-1 --profile profilename"' && sleep 4

replace the xxxxxxxxxxxxxxxxx with your Ec2 target and profilename with your AWS profile you setup.


Under Connections, setup a connection and set the computer name to 12.0.0.1 and the port to the port specified in the script in this case 9999


Under Tasks, select a Connect Task and select Use and existing task and the task you just created; check the Wait for connect task completion.


Note this assumes you have SSM working already in the command line on your Mac.


2 people have this question

Hi Daniel,


could you please create a support ticket, attaching screenshots of your (command)tasks' / connections' configuration, so we can have a look:

https://www.royalapps.com/go/support-ticket-new


thanks & best regards,

Christoph

I want to know what the solution was because i also want to apply it


1 person likes this
Answer

Create a task with the following settings


General

Check Run in Terminal

Check No confirmation required

Command

macOS

command: osascript

Arguments: -e 'tell application "Terminal" to do script "aws ssm start-session --target i-xxxxxxxxxxxxxxxxx --document-name AWS-StartPortForwardingSession --parameters \"localPortNumber=9999,portNumber=3389\" --region us-east-1 --profile profilename"' && sleep 4

replace the xxxxxxxxxxxxxxxxx with your Ec2 target and profilename with your AWS profile you setup.


Under Connections, setup a connection and set the computer name to 12.0.0.1 and the port to the port specified in the script in this case 9999


Under Tasks, select a Connect Task and select Use and existing task and the task you just created; check the Wait for connect task completion.


Note this assumes you have SSM working already in the command line on your Mac.

Login or Signup to post a comment