
Ich frage mich, warum dieser Befehl funktioniert (1):
ssh -i .ssh/my-dev.pem ubuntu@i-1234abc
Dieser Befehl schlägt jedoch mit dem folgenden Fehler fehl (2):
ssh myec2
Der Fehler ist:
An error occurred (TargetNotConnected) when calling the StartSession operation: myec2 is not connected.
Connection closed by UNKNOWN port 65535
Das ist mein .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'"
Das Ausführen von Befehl (2) mit der obigen Konfiguration sollte nach meinem Verständnis dasselbe sein wie Befehl (1). Es gibt also etwas, das ich nicht verstehe.