Problem
When attempting to use "Connect VS Code to EC2" via AWS Toolkit (v4.4.0) on Windows, the connection fails during SSH configuration generation.
The error occurs during the SSH config validation step and prevents establishing the remote connection.
Relevant sanitized error log:
[error] ec2: failed to add ssh config section:
Pseudo-terminal will not be allocated because stdin is not a terminal.
vdollar_percent_expand: unknown key %r
percent_dollar_expand: failed
Final error returned by the extension:
Additional context:
- AWS authentication (SSO) succeeds correctly
- SSH binary is detected correctly
- Key pair generation succeeds
- Failure happens specifically when processing SSH config (
ssh -G)
Also observed:
- Warning about missing default region (falls back to us-east-1)
session-manager-plugin not being detected initially
Steps to reproduce the issue
- Open VS Code with AWS Toolkit installed
- Authenticate using AWS SSO
- Navigate to EC2 instances
- Click "Connect to EC2 using VS Code"
- Select the target instance
- Wait for the connection process to initialize
Expected behavior
VS Code should:
- Generate a valid SSH config
- Establish a remote connection to the EC2 instance
- Open a remote workspace successfully
Sytem details (run AWS: About) and/or Amazon Q: About
- OS: Windows 11 Enterprise (Version 25H2, Build 10.0.26200)
- Visual Studio Code version: 1.120.0
- Electron: 39.8.8
- Node: 22.22.1
- V8: 14.2.231.22-electron.0
- AWS Toolkit Version: 4.4.0
- Amazon Q version: (not explicitly shown in logs)
Additional context
1. SSH environment
The error strongly suggests an issue in SSH config parsing:
vdollar_percent_expand: unknown key %r
This may indicate incompatibility between:
- The generated SSH config from AWS Toolkit
- The SSH client being used on Windows (
Git Bash ssh.exe)
Detected SSH binary:
C:\Users\<user>\AppData\Local\Programs\Git\usr\bin\ssh.exe
2. Session Manager plugin
Logs show:
Command: session-manager-plugin.exe --version (not started)
This may indicate:
- Plugin not installed
- Plugin not in PATH
- Or Toolkit failing to locate it properly
3. Cross-platform test (Linux / WSL)
The same issue was reproduced in a Kali Linux environment (Debian-based) running via WSL.
Command used:
Observed behavior:
- The connection flow fails with an error referencing Windows-specific path:
C:\WINDOWS\system32\wsl.exe
This suggests:
- AWS Toolkit may be incorrectly assuming a Windows host context even when running inside WSL
- Or misdetecting the execution environment
4. Goal of this issue
The goal is to understand:
- Why the SSH config generation fails (
%r expansion error)
- Whether this is related to:
- SSH client compatibility (OpenSSH vs Git SSH)
- AWS Toolkit config generation bug
- Missing dependencies (session-manager-plugin)
- Environment detection issues (Windows vs WSL)
- What is the correct setup required to make EC2 remote connection via VS Code work reliably on Windows.
Problem
When attempting to use "Connect VS Code to EC2" via AWS Toolkit (v4.4.0) on Windows, the connection fails during SSH configuration generation.
The error occurs during the SSH config validation step and prevents establishing the remote connection.
Relevant sanitized error log:
Final error returned by the extension:
Additional context:
ssh -G)Also observed:
session-manager-pluginnot being detected initiallySteps to reproduce the issue
Expected behavior
VS Code should:
Sytem details (run
AWS: About) and/orAmazon Q: AboutAdditional context
1. SSH environment
The error strongly suggests an issue in SSH config parsing:
This may indicate incompatibility between:
Git Bash ssh.exe)Detected SSH binary:
2. Session Manager plugin
Logs show:
This may indicate:
3. Cross-platform test (Linux / WSL)
The same issue was reproduced in a Kali Linux environment (Debian-based) running via WSL.
Command used:
Observed behavior:
This suggests:
4. Goal of this issue
The goal is to understand:
%rexpansion error)