I have the following use case:
I can run the following command just fine: (those are AWS Instances I'm ssh'ing onto):
ssh i-0518b235de43acdcd
ssh i-0ba5ca0c58dbfeebb
My ssh config has the following, which makes those ssh commands work:
host i-*
ProxyCommand aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters "portNumber=22"
IdentityFile ~/.ssh/id_rsa
User ec2-user
But it ONLY works if my AWS Access and Secret key (or profile) are set in the terminal that is running ssh.
When I run csshX i-0518b235de43acdcd i-0ba5ca0c58dbfeebb, it launches the Terminal.app in a NEW window that does NOT have those access/secret (or profile) set, so ssh fails.
Is there a way to call csshX to set some env vars (or run a script) in Terminal.app PRIOR to running the ssh command?
Thanks!