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
feita há 8 meses319 visualizações
2 Respostas
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
ESPECIALISTA
respondido há 8 meses
profile picture
ESPECIALISTA
avaliado há 8 meses
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
respondido há 8 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas