AWS SSM (session-manager-plugin) start-session command doesn't work in Git Bash on Windows
Closed this issue · 10 comments
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- I've gone though the User Guide and the API reference
- I've searched for previous similar issues and didn't find any solution
Describe the bug
While running start-session
in Git Bash, the Git-bash freezes. This occurs only for Git-bash
and works fine in CMD
or POWERSHELL
Use Git Bash
on Windows and run:
aws ssm start-session --target i-xxxxxxx
Starting session with SessionId: xxxxxx@xxxxxx.gaia.kosmos-00f4a5082a34f7da5
sh-4.2$ ls -la
The terminal
freezes at this point and needs to killed.
SDK version number
aws-cli/1.16.230 Python/3.6.0 Windows/10 botocore/1.12.220
session-manager-plugin --version
1.1.61.0
Platform/OS/Hardware/Device
OS Name Microsoft Windows 10 Enterprise
Version 10.0.17134 Build 17134
What are you running the cli on?
Git Bash
To Reproduce (observed behavior)
Same as above
Use Git Bash
on Windows and run:
aws ssm start-session --target i-xxxxxxx
sh-4.2$ ls -la
^C
The Git bash
freezes after running ls -la
on the SSM started shell: sh-4.2$
Expected behavior
The start-session
should create a session
and allow running commands on that shell (instead of freezing the bash
(Windows
)) normally as it does for CMD
and POWERSHELL
Logs/output
AWS CLI output:
Starting session with SessionId: xxxxxx@xxxxxx.gaia.kosmos-00f4a5082a34f7da5
session-manager-plugin.log
2020-08-25 19:25:29 DEBUG [Start @ config_watcher.go.41] Start Watcher on directory: C:\Program Files\Amazon\SessionManagerPlugin
2020-08-25 19:25:29 ERROR [InitDisplayMode @ sessionutil_windows.go.41] error getting console mode: The handle is invalid.
2020-08-25 19:25:29 ERROR [InitDisplayMode @ sessionutil_windows.go.50] error setting console mode: The handle is invalid.
2020-08-25 19:25:29 DEBUG [Initialize @ streaming.go.137] Calling Initialize Datachannel for role: publish_subscribe
2020-08-25 19:25:29 INFO [OpenConnection @ websocketutil.go.48] Opening websocket connection to: %!(EXTRA string=wss://ssmmessages.us-east-2.amazonaws.com/v1/data-channel/xxxxxx@xxxxxx.gaia.kosmos-00f4a5082a34f7da5?role=publish_subscribe)
2020-08-25 19:25:30 ERROR [func1 @ shellsession.go.101] Could not get size of the terminal: The handle is invalid., using width 300 height 100
2020-08-25 19:25:30 ERROR [func1 @ shellsession.go.101] Could not get size of the terminal: The handle is invalid., using width 300 height 100
2020-08-25 19:25:31 INFO [OpenConnection @ websocketutil.go.56] Successfully opened websocket connection to: %!(EXTRA string=wss://ssmmessages.us-east-2.amazonaws.com/v1/data-channel/xxxxxx@xxxxxx.gaia.kosmos-00f4a5082a34f7da5?role=publish_subscribe)
2020-08-25 19:25:31 INFO [FinalizeDataChannelHandshake @ streaming.go.175] Sending token through data channel wss://ssmmessages.us-east-2.amazonaws.com/v1/data-channel/xxxxxx@xxxxxx.gaia.kosmos-00f4a5082a34f7da5?role=publish_subscribe to acknowledge connection
2020-08-25 19:25:31 DEBUG [func1 @ websocketchannel.go.83] WebsocketChannel: Send ping. Message.
2020-08-25 19:25:31 ERROR [func1 @ shellsession.go.101] Could not get size of the terminal: The handle is invalid., using width 300 height 100
2020-08-25 19:25:31 DEBUG [OutputMessageHandler @ streaming.go.377] Processing stream data message of type: output_stream_data
2020-08-25 19:25:31 DEBUG [HandleOutputMessage @ streaming.go.613] Process new incoming stream data message. Sequence Number: 0
2020-08-25 19:25:31 WARN [ProcessFirstMessage @ sessionhandler.go.71] Setting session type to shell based on PayloadType!
2020-08-25 19:25:31 ERROR [func1 @ shellsession.go.101] Could not get size of the terminal: The handle is invalid., using width 300 height 100
session-manager-plugin command output:
The Session Manager plugin was installed successfully. Use the AWS CLI to start a session.
Additional context
Mentioned above also
This error Could not get size of the terminal: The handle is invalid., using width 300 height 100
is thrown only for Git-bash
. For CMD
and POWERSHELL
,aws ssm start-session i-xxxxxxx
works perfectly fine.
Hi @aryak007, does this persist on a more recent version of the AWS CLI? If it does, I'll inform the SSM team about this, who manages this plugin. Looking through the AWS SSM documentation, PowerShell seems to be the supported method of use.
Hello @kdaily,
Yes, we tried it with aws-cli/2.0.48 Python/3.7.7 Windows/10 exe/AMD64
in Git-Bash
and we're still facing the same issue.
Correct. Powershell is a supported method (mentioned in the AWS SSM Documentation) but we also have a very important use case of running ssm
in Git-Bash
. It'd be great if the SSM
team can take a look.
Thanks
Hi @aryak007, I let the SSM team know of the issue. I can't give you an ETA on when I will hear back about an expected resolution. If you have an AWS support account, I would suggest opening a case there. Thanks!
I ran into the same problem today (see config below). @aryak007 Did you, by any chance, find a workaround ? 🤞
$ aws --version
aws-cli/2.0.42 Python/3.7.7 Windows/10 exe/AMD64
$ session-manager-plugin --version
1.1.61.0
I ran into the same problem today while executing "aws ecs execute-command --command "bash" --interactive."
My use case also need me t use git bash only, cant use CMD or Powershell.
Were you able to found any work around.?
$aws --version
aws-cli/2.1.34 Python/3.8.8 Windows/10 exe/AMD64 prompt/off
$session-manager-plugin --version
1.2.245.0
Any update on this issue? We use Git Bash for our Windows developers and would be of great help if we can use this plugin via bash.
Checking in with the SSM team, I'll let you know if I get some new information. Thanks!
D18163543
I'm going to transfer this issue to the session-manager-plugin repository as it seems like the more appropriate place to track the issue going forward. (Update: I wasn't able to transfer this issue so I created a new one for tracking going forward here: aws/session-manager-plugin#53). We haven't received any updates internally on this issue but I did just ping the SSM team for another update. You can also consider reaching out to AWS Support for further escalation of this issue.
⚠️ COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.