Windows標準のsshだけでVSCodeからRemote-SSHプラグインで接続したいというときの .ssh/config
の設定例を載せておきます。
注意点として、Organization環境でSSOログインが必要な場合は事前に aws sso login
しておく必要があります
EC2にsession-manager プラグインで接続するときの設定
.ssh\config
Host ssm-ssh
User ec2-user
HostName i-xxxxxx
IdentityFile <env:USERPROFILE>\.ssh\keypair.pem
ProxyCommand c:\Windows\System32\cmd.exe /k aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters "portNumber=%p" --profile session-manager-ssh
Organization環境で AWS SSOを使用する場合
.aws\config
[sso-session who]
sso_start_url = https://d-xxxxxx.awsapps.com/start
sso_region = ap-northeast-1
sso_registration_scopes = sso:account:access
[profile session-manager-ssh]
sso_session = who
sso_account_id = 123456789012
sso_role_name = AWSAdministratorAccess
region = ap-northeast-1
output = json
利用方法
aws sso login --sso-session who
# Windows 標準のsshで接続する場合
ssh ssm-ssh
# .ssh\configに記載するとVSCodeのRemote-SSH を開くと接続できるようになってる