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
質問済み 7ヶ月前311ビュー
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
エキスパート
回答済み 7ヶ月前
profile picture
エキスパート
レビュー済み 7ヶ月前
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
回答済み 7ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ