호스트 별칭이 예상대로 작동하지 않는 AWS SSM SSH

호스트 별칭이 예상대로 작동하지 않는 AWS SSM SSH

이 명령이 작동하는 이유가 궁금합니다 (1).

ssh -i .ssh/my-dev.pem ubuntu@i-1234abc

그러나 이 명령은 아래 오류(2)와 함께 실패합니다.

ssh myec2

오류는 다음과 같습니다

An error occurred (TargetNotConnected) when calling the StartSession operation: myec2 is not connected.
Connection closed by UNKNOWN port 65535

이것은 나의 .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'"

위 구성으로 명령 (2)를 실행하는 것은 내 이해에 따르면 명령 (1)과 동일해야 합니다. 그래서 제가 이해하지 못하는 것이 있습니다.

관련 정보