I'm wondering why this command works (1):
ssh -i .ssh/my-dev.pem ubuntu@i-1234abc
But this command fails with the error below (2):
ssh myec2
The error is:
An error occurred (TargetNotConnected) when calling the StartSession operation: myec2 is not connected.
Connection closed by UNKNOWN port 65535
This is my .ssh/config:
Host myec2
User ubuntu
HostName i-1234abc
IdentityFile ~/.ssh/my-dev.pem
ProxyCommand sh -c "aws --profile myawsprofile --region us-east-1 ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
Host i-* mi-*
IdentityFile ~/.ssh/my-dev.pem
ProxyCommand sh -c "aws --profile myawsprofile --region us-east-1 ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
Running command (2) with the above config, should be the same as command (1), by my understanding. So there's something I don't understand.