can't connect my ec2 using ssh

0

Failed to connect to your instance EC2 Instance Connect is unable to connect to your instance. Ensure your instance network settings are configured correctly for EC2 Instance Connect. For more information, see Set up EC2 Instance Connect at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-set-up.html.

some time later, I can't connect with my Ec2 using ssh . ec2 instance connect either . the error as above .

  • Did you try troubleshooting on your own? What have you tried / done?

will
已提問 8 個月前檢視次數 319 次
2 個答案
1

Hi, please follow https://repost.aws/knowledge-center/ec2-instance-connect-troubleshooting for detailled guidance on troubleshooting connection with Instance Connect.

It is most often an issue with security or IP routing in your VPC.

Best,

Didier

profile pictureAWS
專家
已回答 8 個月前
profile picture
專家
已審閱 8 個月前
0

Approach 1

Please check the security settings. You might need to add inbound SSH connections from everywhere. If it's all okay, then follow approach two.

Approach 2

    1. Connect to your instance using SSH.
    1. Use the SSH key pair that was assigned to your instance when you launched it and use the default user name of the AMI that you used to launch your instance , for Amazon Linux 2, the default user name is ec2-user
    1. Use the following command to SSH into your instance:

    ssh -i my_ec2_private_key.pem ec2-user@<your instance's public DNS name>

  • Install the EC2 Instance Connect package on your instance. For Amazon Linux 2, use the yum install command.

    sudo yum install ec2-instance-connect

Approach 3

  1. Go to your AWS EC2 console
  2. Select your instance that is not able to connect
  3. Stop your instance
  4. Go to Actions -> Instance Settings -> Edit User Data
  5. Add user data in to update Firewall setting etc in user data
  6. Save this and restart instance.
profile picture
已回答 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南