How to fix the error Failed to connect to your instance?

0

Unable to connect the instance after restarting the server by using the command sudo systemctl reboot. When I'm trying to login into the instance using EC2 Instance Connect it is failing to make the connection to the instance and throwing an error

We were unable to connect to your instance. Make sure that your instance network settings are configured correctly for EC2 Instance Connect. For more information, check Task 1 under the Setup EC2 Instance Connect AWS documentation.

After following the doc I have added an Inbound rule that allows inbound SSH traffic on port 22 from your IP address to the security group attached to my instance. But still, it shows the same error and also fails the Instance reachability check.

Any help in guiding me that how can I make a connection to my instance will be much appreciated.

Thanks

2개 답변
1

A few points to consider:

  • EC2 Instance Connect (EIC) requires installation in your host operating system. Some managed AWS AMIs have Instance Connect pre-installed - namely, Amazon Linux and Ubuntu 20.04 and later. If you are not using one of these operating systems, you will need to install EIC.
  • Your instance needs connectivity to AWS EIC service endpoints, either public ones using the internet, or via a private EIC endpoint
  • Your users need connectivity to the instance - even if you are connecting via the Console. There are two ways to establish that connectivity - by giving internet access to your instance, or by creating a private connection y using AWS Direct Connect, AWS Site-to-Site VPN, or VPC peering, so that your users can reach the instance's private IP address.
  • You need to allow TCP access on port 22 (sounds like you have already done this).
  • Every IAM user that you want to connect to your instance via EIC will need appropriate permissions.

The link Chirag posted is a useful reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-prerequisites.html

You can also read more about how the service works - in short, by adding an SSH key temporarily to the instance to allow you to connect, then removing it when your session ends - here: https://aws.amazon.com/blogs/security/use-ec2-instance-connect-to-provide-secure-ssh-access-to-ec2-instances-with-private-ip-addresses/

profile pictureAWS
답변함 6달 전
profile picture
전문가
검토됨 2달 전
0

Hello,

I am assuming this is a new instance. Did you try to check the Routing settings ? From where are you trying to access the instance ? Does it have an internet gateway attached and the routing set correctly. I am assuming NACL/SG settings are correctly set ?

Refer the link below for the pre-requisites required.

Link- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connection-prereqs.html

profile pictureAWS
지원 엔지니어
답변함 2년 전

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

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

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

관련 콘텐츠