Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instance-portforward() for SSM portforwarding #327

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rawiriblundell
Copy link

image

Hi,
For those of us who are leaning more on SSM vs traditional VPN's/Bastions/etc, portforwarding is a powerful and secure way to access services on our AWS based instances. It's just like ssh portforwarding that we all know and love. Unfortunately, the command to run to stand-up a portforward is somewhat verbose and obnoxious. Which is where this function comes in.

Some examples are given in the committed code, but to offer some additional high-level examples here:

So let's say you've got a Windows based instance and you need to RDP to it - you can just setup a portforward:

instances mywindowshost | instance-portforward 3389

That will connect to the given instance's port 3389, and as we haven't supplied a second port number to locally map to, it will automatically attempt to use the same number as the first i.e. instance:3389 <--> localhost:3389

Then fire up an RDP client of choice and connect to localhost (Port 3389 is implied in this case)

Let's say we want to connect that remote port to local port 5006 instead:

instances mywindowshost | instance-portforward 3389 5006

Then fire up an RDP client of choice and connect to localhost:5006

I have also coded in port aliases based on the list that Amazon has built into its security group management. So, the previous example could also be expressed like:

instances mywindowshost | instance-portforward rdp 5006

I have tested this successfully with SSH, RDP, MS-SQL Management Studio and a handful of custom ports for web-UI's and API's.

I have at least one more commit to get-in to shore-up the documentation, but I figured I'd get this PR rolling in the meantime.

Discussion welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant