Private SSH connection not connecting to EC2 ?

0

The EC2 instance I made is configured with VPC, Subnet, Security Group with permissions ( All traffic ) for SSH and a User with the necessary permissions to interact with the private EC2. I tried to establish a connection via ssh from the command line ( ssh -i "keypair.pem" ec2-user@myipprivado ) and it doesn't connect? The Key Pair has chmod 400 permission and the connection path is correct, I don't know why I can't establish a connection with the instance ?

질문됨 일 년 전387회 조회
3개 답변
0

Are you getting any error message at all or is it just sitting there until timing out?

To be able to connect to the target's private IP, the source must also be in the same VPC. The source must have a security group rule allowing outbound over port 22 to the target's private IP, and the target must have a rule allowing inbound over port 22 from the source's private IP.

If the source & target are in different VPCs then the VPCs need to be peered for the above to work.

If the source is trying to connect over the internet then the target's public IP needs to be used, not the private IP.

Does that make things any clearer?

profile picture
전문가
Steve_M
답변함 일 년 전
  • I configured outgoing ssh rules for the EC2 remote ip and incoming ssh for the local ip. But it tries to connect and it doesn't show any error message.

  • It's less clear now than it was before.

    The EC2 instance that you are having trouble, from what are you trying to connect to it?

    Are you trying to connect from another EC2 instance in the same VPC?

0

What exact error do you see? Is the instance in public/private subnet?

profile picture
답변함 일 년 전
  • It keeps trying to connect until the time expires, it does not show an error. Regarding the instance, it is related to a vpc, also linking the subnet to the vpc.

0

check if you can telnet the 22 port, if not then security group as well if any os firewall like iptables are blocking

sourav
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠