StartPortForwardingSession: parameter to keep connection active
The StartPortForwardingSession command is awesome. However, I noticed that the tunnel gets closed if the connection drops, which in my case is an intended behaviour (e.g. I query a postgres db multiple times during the execution of a python script). I understand this feature was added in version 1.1.33.0 of the Session Manager plugin (see here).
Is there a solution (not a workaround) to prevent the tunnel to get closed, e.g. by adding a parameter?
aws ssm start-session --target ${TARGET} --document-name AWS-StartPortForwardingSession --parameters '{"portNumber":["5432"],"localPortNumber":["5433"],"dropConnection":["False"]}'
Thanks for reaching out. With the latest version of SSM Agent and Session Manager Plugin, tunnel disconnect issue should be resolved. Can we please get the agent and plugin versions you are using?
I am using version:
$ aws --version
aws-cli/1.16.260 Python/3.7.5 Darwin/18.7.0 botocore/1.12.250
$ session-manager-plugin --version
1.1.54.0
amazon-ssm-agent 2.3.672.0 1480 stable/… aws✓ classic
Btw, by looking at this issue, it turned out we are using the latest version available on the snap channel, which happens to be older than the latest release on GitHub. Can you please synchronize the snap release? Or is there another way to install it?
Hi @rdisipio:
Thank you for your interest about Amazon-ssm-agent. We've released the 2.3.714.0 to Ubuntu Snap as requested. Feel free to let us know if you have any question.
Have same issue. On client:
aws --version aws-cli/1.18.15 Python/3.7.5 Linux/5.3.0-40-generic botocore/1.15.15 session-manager-plugin --version 1.1.54.0
On Server:
amazon-ssm-agent - v2.3.871.0
Command:
aws ssm start-session --target i-XXXXXXXXXXX --document-name AWS-StartPortForwardingSession --parameters '{"portNumber":["8080"], "localPortNumber":["8080"]}'
Starting session with SessionId: XXXXXX-04d5472fdfa6419db Port 8080 opened for sessionId XXXXXX-04d5472fdfa6419db. Connection accepted for session XXXXXX-04d5472fdfa6419db.
When I run on command:
curl 127.0.0.1:8080 -v On server I have at last line:
- Closing connection 0
When I run on client, command is stuck. Server not response for any other connections.